A processor that allows the user to run a paginated query (with aggregations) written with the Elasticsearch JSON DSL. It will use the flowfile's content for the query unless the QUERY attribute is populated. Search After/Point in Time queries must include a valid "sort" field.
elasticsearch, elasticsearch5, elasticsearch6, elasticsearch7, elasticsearch8, query, scroll, page, read, json
In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.
Display Name | API Name | Default Value | Allowable Values | Description |
---|---|---|---|---|
Query | el-rest-query | A query in JSON syntax, not Lucene syntax. Ex: {"query":{"match":{"somefield":"somevalue"}}}. If this parameter is not set, the query will be read from the flowfile content. Supports Expression Language: true (will be evaluated using flow file attributes and variable registry) | ||
Query Attribute | el-query-attribute | If set, the executed query will be set on each result flowfile in the specified attribute. Supports Expression Language: true (will be evaluated using flow file attributes and variable registry) | ||
Index | el-rest-fetch-index | The name of the index to use. Supports Expression Language: true (will be evaluated using flow file attributes and variable registry) | ||
Type | el-rest-type | The type of this document (used by Elasticsearch for indexing and searching). Supports Expression Language: true (will be evaluated using flow file attributes and variable registry) | ||
Client Service | el-rest-client-service | Controller Service API: ElasticSearchClientService Implementation: ElasticSearchClientServiceImpl | An Elasticsearch client service to use for running queries. | |
Search Results Split | el-rest-split-up-hits | PER_RESPONSE |
| Output a flowfile containing all hits or one flowfile for each individual hit or one flowfile containing all hits from all paged responses. |
Search Results Format | el-rest-format-hits | FULL |
| Format of Hits output. |
Aggregation Results Split | el-rest-split-up-aggregations | PER_RESPONSE |
| Output a flowfile containing all aggregations or one flowfile for each individual aggregation. |
Aggregation Results Format | el-rest-format-aggregations | FULL |
| Format of Aggregation output. |
Pagination Type | el-rest-pagination-type | SCROLL |
| Pagination method to use. Not all types are available for all Elasticsearch versions, check the Elasticsearch docs to confirm which are applicable and recommended for your service. |
Pagination Keep Alive | el-rest-pagination-keep-alive | 10 mins | Pagination "keep_alive" period. Period Elasticsearch will keep the scroll/pit cursor alive in between requests (this is not the time expected for all pages to be returned, but the maximum allowed time for requests between page retrievals). | |
Output No Hits | el-rest-output-no-hits | false |
| Output a "hits" flowfile even if no hits found for query. If true, an empty "hits" flowfile will be output even if "aggregations" are output. |
Supports Sensitive Dynamic Properties: No
Dynamic Properties allow the user to specify both the name and value of a property.
Name | Value | Description |
---|---|---|
The name of a URL query parameter to add | The value of the URL query parameter | Adds the specified property name/value as a query parameter in the Elasticsearch URL used for processing. These parameters will override any matching parameters in the query request body Supports Expression Language: true (will be evaluated using flow file attributes and variable registry) |
Name | Description |
---|---|
aggregations | Aggregations are routed to this relationship. |
failure | All flowfiles that fail for reasons unrelated to server availability go to this relationship. |
original | All original flowfiles that don't cause an error to occur go to this relationship. |
hits | Search hits are routed to this relationship. |
Name | Description |
---|---|
mime.type | application/json |
aggregation.name | The name of the aggregation whose results are in the output flowfile |
aggregation.number | The number of the aggregation whose results are in the output flowfile |
page.number | The number of the page (request) in which the results were returned that are in the output flowfile |
hit.count | The number of hits that are in the output flowfile |
elasticsearch.query.error | The error message provided by Elasticsearch if there is an error querying the index. |
Resource | Description |
---|---|
MEMORY | Care should be taken on the size of each page because each response from Elasticsearch will be loaded into memory all at once and converted into the resulting flowfiles. |