github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/outputs/elasticsearch.md (about)

     1  ---
     2  title: elasticsearch
     3  type: output
     4  status: stable
     5  categories: ["Services"]
     6  ---
     7  
     8  <!--
     9       THIS FILE IS AUTOGENERATED!
    10  
    11       To make changes please edit the contents of:
    12       lib/output/elasticsearch.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  
    19  Publishes messages into an Elasticsearch index. If the index does not exist then
    20  it is created with a dynamic mapping.
    21  
    22  
    23  <Tabs defaultValue="common" values={[
    24    { label: 'Common', value: 'common', },
    25    { label: 'Advanced', value: 'advanced', },
    26  ]}>
    27  
    28  <TabItem value="common">
    29  
    30  ```yaml
    31  # Common config fields, showing default values
    32  output:
    33    label: ""
    34    elasticsearch:
    35      urls:
    36        - http://localhost:9200
    37      index: benthos_index
    38      id: ${!count("elastic_ids")}-${!timestamp_unix()}
    39      type: doc
    40      max_in_flight: 1
    41      batching:
    42        count: 0
    43        byte_size: 0
    44        period: ""
    45        check: ""
    46  ```
    47  
    48  </TabItem>
    49  <TabItem value="advanced">
    50  
    51  ```yaml
    52  # All config fields, showing default values
    53  output:
    54    label: ""
    55    elasticsearch:
    56      urls:
    57        - http://localhost:9200
    58      index: benthos_index
    59      action: index
    60      pipeline: ""
    61      id: ${!count("elastic_ids")}-${!timestamp_unix()}
    62      type: doc
    63      routing: ""
    64      sniff: true
    65      healthcheck: true
    66      timeout: 5s
    67      tls:
    68        enabled: false
    69        skip_cert_verify: false
    70        enable_renegotiation: false
    71        root_cas: ""
    72        root_cas_file: ""
    73        client_certs: []
    74      max_in_flight: 1
    75      max_retries: 0
    76      backoff:
    77        initial_interval: 1s
    78        max_interval: 5s
    79        max_elapsed_time: 30s
    80      basic_auth:
    81        enabled: false
    82        username: ""
    83        password: ""
    84      batching:
    85        count: 0
    86        byte_size: 0
    87        period: ""
    88        check: ""
    89        processors: []
    90      aws:
    91        enabled: false
    92        region: eu-west-1
    93        endpoint: ""
    94        credentials:
    95          profile: ""
    96          id: ""
    97          secret: ""
    98          token: ""
    99          role: ""
   100          role_external_id: ""
   101      gzip_compression: false
   102  ```
   103  
   104  </TabItem>
   105  </Tabs>
   106  
   107  Both the `id` and `index` fields can be dynamically set using function
   108  interpolations described [here](/docs/configuration/interpolation#bloblang-queries). When
   109  sending batched messages these interpolations are performed per message part.
   110  
   111  ### AWS
   112  
   113  It's possible to enable AWS connectivity with this output using the `aws`
   114  fields. However, you may need to set `sniff` and `healthcheck` to
   115  false for connections to succeed.
   116  
   117  ## Performance
   118  
   119  This output benefits from sending multiple messages in flight in parallel for
   120  improved performance. You can tune the max number of in flight messages with the
   121  field `max_in_flight`.
   122  
   123  This output benefits from sending messages as a batch for improved performance.
   124  Batches can be formed at both the input and output level. You can find out more
   125  [in this doc](/docs/configuration/batching).
   126  
   127  ## Fields
   128  
   129  ### `urls`
   130  
   131  A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.
   132  
   133  
   134  Type: `array`  
   135  Default: `["http://localhost:9200"]`  
   136  
   137  ```yaml
   138  # Examples
   139  
   140  urls:
   141    - http://localhost:9200
   142  ```
   143  
   144  ### `index`
   145  
   146  The index to place messages.
   147  This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).
   148  
   149  
   150  Type: `string`  
   151  Default: `"benthos_index"`  
   152  
   153  ### `action`
   154  
   155  The action to take on the document.
   156  This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).
   157  
   158  
   159  Type: `string`  
   160  Default: `"index"`  
   161  Options: `index`, `update`, `delete`.
   162  
   163  ### `pipeline`
   164  
   165  An optional pipeline id to preprocess incoming documents.
   166  This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).
   167  
   168  
   169  Type: `string`  
   170  Default: `""`  
   171  
   172  ### `id`
   173  
   174  The ID for indexed messages. Interpolation should be used in order to create a unique ID for each message.
   175  This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).
   176  
   177  
   178  Type: `string`  
   179  Default: `"${!count(\"elastic_ids\")}-${!timestamp_unix()}"`  
   180  
   181  ### `type`
   182  
   183  The document type.
   184  
   185  
   186  Type: `string`  
   187  Default: `"doc"`  
   188  
   189  ### `routing`
   190  
   191  The routing key to use for the document.
   192  This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).
   193  
   194  
   195  Type: `string`  
   196  Default: `""`  
   197  
   198  ### `sniff`
   199  
   200  Prompts Benthos to sniff for brokers to connect to when establishing a connection.
   201  
   202  
   203  Type: `bool`  
   204  Default: `true`  
   205  
   206  ### `healthcheck`
   207  
   208  Whether to enable healthchecks.
   209  
   210  
   211  Type: `bool`  
   212  Default: `true`  
   213  
   214  ### `timeout`
   215  
   216  The maximum time to wait before abandoning a request (and trying again).
   217  
   218  
   219  Type: `string`  
   220  Default: `"5s"`  
   221  
   222  ### `tls`
   223  
   224  Custom TLS settings can be used to override system defaults.
   225  
   226  
   227  Type: `object`  
   228  
   229  ### `tls.enabled`
   230  
   231  Whether custom TLS settings are enabled.
   232  
   233  
   234  Type: `bool`  
   235  Default: `false`  
   236  
   237  ### `tls.skip_cert_verify`
   238  
   239  Whether to skip server side certificate verification.
   240  
   241  
   242  Type: `bool`  
   243  Default: `false`  
   244  
   245  ### `tls.enable_renegotiation`
   246  
   247  Whether to allow the remote server to repeatedly request renegotiation. Enable this option if you're seeing the error message `local error: tls: no renegotiation`.
   248  
   249  
   250  Type: `bool`  
   251  Default: `false`  
   252  Requires version 3.45.0 or newer  
   253  
   254  ### `tls.root_cas`
   255  
   256  An optional root certificate authority to use. This is a string, representing a certificate chain from the parent trusted root certificate, to possible intermediate signing certificates, to the host certificate.
   257  
   258  
   259  Type: `string`  
   260  Default: `""`  
   261  
   262  ```yaml
   263  # Examples
   264  
   265  root_cas: |-
   266    -----BEGIN CERTIFICATE-----
   267    ...
   268    -----END CERTIFICATE-----
   269  ```
   270  
   271  ### `tls.root_cas_file`
   272  
   273  An optional path of a root certificate authority file to use. This is a file, often with a .pem extension, containing a certificate chain from the parent trusted root certificate, to possible intermediate signing certificates, to the host certificate.
   274  
   275  
   276  Type: `string`  
   277  Default: `""`  
   278  
   279  ```yaml
   280  # Examples
   281  
   282  root_cas_file: ./root_cas.pem
   283  ```
   284  
   285  ### `tls.client_certs`
   286  
   287  A list of client certificates to use. For each certificate either the fields `cert` and `key`, or `cert_file` and `key_file` should be specified, but not both.
   288  
   289  
   290  Type: `array`  
   291  Default: `[]`  
   292  
   293  ```yaml
   294  # Examples
   295  
   296  client_certs:
   297    - cert: foo
   298      key: bar
   299  
   300  client_certs:
   301    - cert_file: ./example.pem
   302      key_file: ./example.key
   303  ```
   304  
   305  ### `tls.client_certs[].cert`
   306  
   307  A plain text certificate to use.
   308  
   309  
   310  Type: `string`  
   311  Default: `""`  
   312  
   313  ### `tls.client_certs[].key`
   314  
   315  A plain text certificate key to use.
   316  
   317  
   318  Type: `string`  
   319  Default: `""`  
   320  
   321  ### `tls.client_certs[].cert_file`
   322  
   323  The path to a certificate to use.
   324  
   325  
   326  Type: `string`  
   327  Default: `""`  
   328  
   329  ### `tls.client_certs[].key_file`
   330  
   331  The path of a certificate key to use.
   332  
   333  
   334  Type: `string`  
   335  Default: `""`  
   336  
   337  ### `max_in_flight`
   338  
   339  The maximum number of messages to have in flight at a given time. Increase this to improve throughput.
   340  
   341  
   342  Type: `int`  
   343  Default: `1`  
   344  
   345  ### `max_retries`
   346  
   347  The maximum number of retries before giving up on the request. If set to zero there is no discrete limit.
   348  
   349  
   350  Type: `int`  
   351  Default: `0`  
   352  
   353  ### `backoff`
   354  
   355  Control time intervals between retry attempts.
   356  
   357  
   358  Type: `object`  
   359  
   360  ### `backoff.initial_interval`
   361  
   362  The initial period to wait between retry attempts.
   363  
   364  
   365  Type: `string`  
   366  Default: `"1s"`  
   367  
   368  ### `backoff.max_interval`
   369  
   370  The maximum period to wait between retry attempts.
   371  
   372  
   373  Type: `string`  
   374  Default: `"5s"`  
   375  
   376  ### `backoff.max_elapsed_time`
   377  
   378  The maximum period to wait before retry attempts are abandoned. If zero then no limit is used.
   379  
   380  
   381  Type: `string`  
   382  Default: `"30s"`  
   383  
   384  ### `basic_auth`
   385  
   386  Allows you to specify basic authentication.
   387  
   388  
   389  Type: `object`  
   390  
   391  ### `basic_auth.enabled`
   392  
   393  Whether to use basic authentication in requests.
   394  
   395  
   396  Type: `bool`  
   397  Default: `false`  
   398  
   399  ### `basic_auth.username`
   400  
   401  A username to authenticate as.
   402  
   403  
   404  Type: `string`  
   405  Default: `""`  
   406  
   407  ### `basic_auth.password`
   408  
   409  A password to authenticate with.
   410  
   411  
   412  Type: `string`  
   413  Default: `""`  
   414  
   415  ### `batching`
   416  
   417  Allows you to configure a [batching policy](/docs/configuration/batching).
   418  
   419  
   420  Type: `object`  
   421  
   422  ```yaml
   423  # Examples
   424  
   425  batching:
   426    byte_size: 5000
   427    count: 0
   428    period: 1s
   429  
   430  batching:
   431    count: 10
   432    period: 1s
   433  
   434  batching:
   435    check: this.contains("END BATCH")
   436    count: 0
   437    period: 1m
   438  ```
   439  
   440  ### `batching.count`
   441  
   442  A number of messages at which the batch should be flushed. If `0` disables count based batching.
   443  
   444  
   445  Type: `int`  
   446  Default: `0`  
   447  
   448  ### `batching.byte_size`
   449  
   450  An amount of bytes at which the batch should be flushed. If `0` disables size based batching.
   451  
   452  
   453  Type: `int`  
   454  Default: `0`  
   455  
   456  ### `batching.period`
   457  
   458  A period in which an incomplete batch should be flushed regardless of its size.
   459  
   460  
   461  Type: `string`  
   462  Default: `""`  
   463  
   464  ```yaml
   465  # Examples
   466  
   467  period: 1s
   468  
   469  period: 1m
   470  
   471  period: 500ms
   472  ```
   473  
   474  ### `batching.check`
   475  
   476  A [Bloblang query](/docs/guides/bloblang/about/) that should return a boolean value indicating whether a message should end a batch.
   477  
   478  
   479  Type: `string`  
   480  Default: `""`  
   481  
   482  ```yaml
   483  # Examples
   484  
   485  check: this.type == "end_of_transaction"
   486  ```
   487  
   488  ### `batching.processors`
   489  
   490  A list of [processors](/docs/components/processors/about) to apply to a batch as it is flushed. This allows you to aggregate and archive the batch however you see fit. Please note that all resulting messages are flushed as a single batch, therefore splitting the batch into smaller batches using these processors is a no-op.
   491  
   492  
   493  Type: `array`  
   494  Default: `[]`  
   495  
   496  ```yaml
   497  # Examples
   498  
   499  processors:
   500    - archive:
   501        format: lines
   502  
   503  processors:
   504    - archive:
   505        format: json_array
   506  
   507  processors:
   508    - merge_json: {}
   509  ```
   510  
   511  ### `aws`
   512  
   513  Enables and customises connectivity to Amazon Elastic Service.
   514  
   515  
   516  Type: `object`  
   517  
   518  ### `aws.enabled`
   519  
   520  Whether to connect to Amazon Elastic Service.
   521  
   522  
   523  Type: `bool`  
   524  Default: `false`  
   525  
   526  ### `aws.region`
   527  
   528  The AWS region to target.
   529  
   530  
   531  Type: `string`  
   532  Default: `"eu-west-1"`  
   533  
   534  ### `aws.endpoint`
   535  
   536  Allows you to specify a custom endpoint for the AWS API.
   537  
   538  
   539  Type: `string`  
   540  Default: `""`  
   541  
   542  ### `aws.credentials`
   543  
   544  Optional manual configuration of AWS credentials to use. More information can be found [in this document](/docs/guides/cloud/aws).
   545  
   546  
   547  Type: `object`  
   548  
   549  ### `aws.credentials.profile`
   550  
   551  A profile from `~/.aws/credentials` to use.
   552  
   553  
   554  Type: `string`  
   555  Default: `""`  
   556  
   557  ### `aws.credentials.id`
   558  
   559  The ID of credentials to use.
   560  
   561  
   562  Type: `string`  
   563  Default: `""`  
   564  
   565  ### `aws.credentials.secret`
   566  
   567  The secret for the credentials being used.
   568  
   569  
   570  Type: `string`  
   571  Default: `""`  
   572  
   573  ### `aws.credentials.token`
   574  
   575  The token for the credentials being used, required when using short term credentials.
   576  
   577  
   578  Type: `string`  
   579  Default: `""`  
   580  
   581  ### `aws.credentials.role`
   582  
   583  A role ARN to assume.
   584  
   585  
   586  Type: `string`  
   587  Default: `""`  
   588  
   589  ### `aws.credentials.role_external_id`
   590  
   591  An external ID to provide when assuming a role.
   592  
   593  
   594  Type: `string`  
   595  Default: `""`  
   596  
   597  ### `gzip_compression`
   598  
   599  Enable gzip compression on the request side.
   600  
   601  
   602  Type: `bool`  
   603  Default: `false`  
   604  
   605