The target-elasticsearch loader sends data into Elasticsearch after it was pulled from a source using an extractor
Getting Started
Prerequisites
If you haven't already, follow the initial steps of the Getting Started guide:
Installation and configuration
-
Add the target-elasticsearch loader to your
project using
:meltano add
-
Configure the target-elasticsearch
settings using
:meltano config
meltano add loader target-elasticsearch
meltano config target-elasticsearch set --interactive
Next steps
Follow the remaining steps of the Getting Started guide:
If you run into any issues, learn how to get help.
Capabilities
The current capabilities for
target-elasticsearch
may have been automatically set when originally added to the Hub. Please review the
capabilities when using this loader. If you find they are out of date, please
consider updating them by making a pull request to the YAML file that defines the
capabilities for this loader.
This plugin has the following capabilities:
- about
- schema-flattening
- stream-maps
You can
override these capabilities or specify additional ones
in your meltano.yml
by adding the capabilities
key.
Settings
The
target-elasticsearch
settings that are known to Meltano are documented below. To quickly
find the setting you're looking for, click on any setting name from the list:
api_key
api_key_id
batch_size_rows
bearer_token
encoded_api_key
host
index_format
index_schema_fields
metadata_fields
password
port
request_timeout
retry_on_timeout
scheme
ssl_ca_file
username
You can also list these settings using
with the meltano config
list
subcommand:
meltano config target-elasticsearch list
You can
override these settings or specify additional ones
in your meltano.yml
by adding the settings
key.
Please consider adding any settings you have defined locally to this definition on MeltanoHub by making a pull request to the YAML file that defines the settings for this plugin.
API Key (api_key)
-
Environment variable:
TARGET_ELASTICSEARCH_API_KEY
Api key for auth key authorization
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set api_key [value]
API Key ID (api_key_id)
-
Environment variable:
TARGET_ELASTICSEARCH_API_KEY_ID
Api key id for auth key authorization
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set api_key_id [value]
Batch Size Rows (batch_size_rows)
-
Environment variable:
TARGET_ELASTICSEARCH_BATCH_SIZE_ROWS
Maximum number of rows in each batch.
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set batch_size_rows [value]
Bearer Token (bearer_token)
-
Environment variable:
TARGET_ELASTICSEARCH_BEARER_TOKEN
Bearer token for bearer authorization
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set bearer_token [value]
Encoded API Key (encoded_api_key)
-
Environment variable:
TARGET_ELASTICSEARCH_ENCODED_API_KEY
Encoded api key for auth key authorization
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set encoded_api_key [value]
Host (host)
-
Environment variable:
TARGET_ELASTICSEARCH_HOST
-
Default Value:
localhost
Host used to connect to elasticsearch
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set host [value]
Index Format (index_format)
-
Environment variable:
TARGET_ELASTICSEARCH_INDEX_FORMAT
-
Default Value:
ecs-{{ stream_name }}-{{ current_timestamp_daily}}
Index Format is used to handle custom index formatting such as specifying -latest
index.
ie. the default index string defined as ecs-{{ stream_name }}-{{ current_timestamp_daily}}
-> ecs-animals-2022-12-25
where the stream name was animals
Default options:
Daily {{ current_timestamp_daily }}
-> 2022-12-25,
Monthly {{ current_timestamp_monthly }}
-> 2022-12,
Yearly {{ current_timestamp_yearly }}
-> 2022.
You can also use fields mapped in index_schema_fields
such as {{ x }}
or {{ timestamp }}
.
There are also helper functions such as:
to daily {{ to_daily(timestamp) }}
,
to monthly {{ to_monthly(timestamp) }}
,
to yearly {{ to_yearly(timestamp) }}
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set index_format [value]
Index Schema Fields (index_schema_fields)
-
Environment variable:
TARGET_ELASTICSEARCH_INDEX_SCHEMA_FIELDS
Index Schema Fields allows you to specify specific record values via jsonpath from the stream to be used in index formulation.
ie. if the stream record looks like {"id": "1", "created_at": "12-13-202000:01:43Z"}
and we want to index the record via create time.
we could specify a mapping like index_timestamp: created_at
in the index_format
we could use a template like ecs-animals-{{ to_daily(index_timestamp) }}
this would put this record onto the index ecs-animals-2020-12-13
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set index_schema_fields [value]
Metadata Fields (metadata_fields)
-
Environment variable:
TARGET_ELASTICSEARCH_METADATA_FIELDS
Metadata Fields can be used to pull out specific fields via jsonpath to be used on for ecs metadata patters
This would best be used for data that has a primary key.
ie. {"guid": 102, "foo": "bar"}
then create a mapping of _id: guid
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set metadata_fields [value]
Password (password)
-
Environment variable:
TARGET_ELASTICSEARCH_PASSWORD
Basic auth password
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set password [value]
Port (port)
-
Environment variable:
TARGET_ELASTICSEARCH_PORT
-
Default Value:
9200
Port use to connect to elasticsearch
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set port [value]
Request Timeout (request_timeout)
-
Environment variable:
TARGET_ELASTICSEARCH_REQUEST_TIMEOUT
-
Default Value:
10
Request timeout in seconds
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set request_timeout [value]
Retry On Timeout (retry_on_timeout)
-
Environment variable:
TARGET_ELASTICSEARCH_RETRY_ON_TIMEOUT
-
Default Value:
true
Retry failed requests on timeout
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set retry_on_timeout [value]
Scheme (scheme)
-
Environment variable:
TARGET_ELASTICSEARCH_SCHEME
-
Default Value:
http
http scheme used for connecting to elasticsearch
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set scheme [value]
SSL Ca File (ssl_ca_file)
-
Environment variable:
TARGET_ELASTICSEARCH_SSL_CA_FILE
Location of the the SSL certificate for cert verification ie. /some/path
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set ssl_ca_file [value]
Username (username)
-
Environment variable:
TARGET_ELASTICSEARCH_USERNAME
Basic auth username
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set username [value]
Expand To Show SDK Settings
Add Record Metadata (add_record_metadata)
-
Environment variable:
TARGET_ELASTICSEARCH_ADD_RECORD_METADATA
Add metadata to records.
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set add_record_metadata [value]
Faker Config Locale (faker_config.locale)
-
Environment variable:
TARGET_ELASTICSEARCH_FAKER_CONFIG_LOCALE
One or more LCID locale strings to produce localized output for: https://faker.readthedocs.io/en/master/#localization
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set faker_config locale [value]
Faker Config Seed (faker_config.seed)
-
Environment variable:
TARGET_ELASTICSEARCH_FAKER_CONFIG_SEED
Value to seed the Faker generator for deterministic output: https://faker.readthedocs.io/en/master/#seeding-the-generator
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set faker_config seed [value]
Flattening Enabled (flattening_enabled)
-
Environment variable:
TARGET_ELASTICSEARCH_FLATTENING_ENABLED
'True' to enable schema flattening and automatically expand nested properties.
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set flattening_enabled [value]
Flattening Max Depth (flattening_max_depth)
-
Environment variable:
TARGET_ELASTICSEARCH_FLATTENING_MAX_DEPTH
The max depth to flatten schemas.
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set flattening_max_depth [value]
Load Method (load_method)
-
Environment variable:
TARGET_ELASTICSEARCH_LOAD_METHOD
-
Default Value:
append-only
The method to use when loading data into the destination. append-only
will always write all input records whether that records already exists or not. upsert
will update existing records and insert new records. overwrite
will delete all existing records and insert all input records.
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set load_method [value]
Stream Map Config (stream_map_config)
-
Environment variable:
TARGET_ELASTICSEARCH_STREAM_MAP_CONFIG
User-defined config values to be used within map expressions.
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set stream_map_config [value]
Stream Maps (stream_maps)
-
Environment variable:
TARGET_ELASTICSEARCH_STREAM_MAPS
Config object for stream maps capability. For more information check out Stream Maps.
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set stream_maps [value]
Validate Records (validate_records)
-
Environment variable:
TARGET_ELASTICSEARCH_VALIDATE_RECORDS
-
Default Value:
true
Whether to validate the schema of the incoming streams.
Configure this setting directly using the following Meltano command:
meltano config target-elasticsearch set validate_records [value]
Something missing?
This page is generated from a YAML file that you can contribute changes to.
Edit it on GitHub!Looking for help?
#plugins-general
channel.