QueryElasticsearchHttp

Description:

Queries Elasticsearch using the specified connection properties. Note that the full body of each page of documents will be read into memory before being written to Flow Files for transfer. Also note that the Elasticsearch max_result_window index setting is the upper bound on the number of records that can be retrieved using this query. To retrieve more records, use the ScrollElasticsearchHttp processor.

Tags:

elasticsearch, query, read, get, http

Properties:

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, whether a property supports the NiFi Expression Language, and whether a property is considered "sensitive", meaning that its value will be encrypted. Before entering a value in a sensitive property, ensure that the nifi.properties file has an entry for the property nifi.sensitive.props.key.

NameDefault ValueAllowable ValuesDescription
Elasticsearch URLElasticsearch URL which will be connected to, including scheme (http, e.g.), host, and port. The default port for the REST API is 9200.
Supports Expression Language: true (will be evaluated using variable registry only)
SSL Context ServiceController Service API:
SSLContextService
Implementations: StandardRestrictedSSLContextService
StandardSSLContextService
The SSL Context Service used to provide client certificate information for TLS/SSL connections. This service only applies if the Elasticsearch endpoint(s) have been secured with TLS/SSL.
UsernameUsername to access the Elasticsearch cluster
Supports Expression Language: true (will be evaluated using variable registry only)
PasswordPassword to access the Elasticsearch cluster
Sensitive Property: true
Supports Expression Language: true (will be evaluated using variable registry only)
Connection Timeout5 secsMax wait time for the connection to the Elasticsearch REST API.
Supports Expression Language: true (will be evaluated using variable registry only)
Response Timeout15 secsMax wait time for a response from the Elasticsearch REST API.
Supports Expression Language: true (will be evaluated using variable registry only)
Proxy Configuration ServiceController Service API:
ProxyConfigurationService
Implementation: StandardProxyConfigurationService
Specifies the Proxy Configuration Controller Service to proxy network requests. If set, it supersedes proxy settings configured per component. Supported proxies: HTTP + AuthN, SOCKS
Proxy HostThe fully qualified hostname or IP address of the proxy server
Supports Expression Language: true (will be evaluated using variable registry only)
Proxy PortThe port of the proxy server
Supports Expression Language: true (will be evaluated using variable registry only)
Proxy UsernameProxy Username
Supports Expression Language: true (will be evaluated using variable registry only)
Proxy PasswordProxy Password
Sensitive Property: true
Supports Expression Language: true (will be evaluated using variable registry only)
QueryThe Lucene-style query to run against ElasticSearch (e.g., genre:blues AND -artist:muddy)
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
Page Size20Determines how many documents to return per page during scrolling.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
IndexThe name of the index to read from. If the property is set to _all, the query will match across all indexes.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
TypeThe (optional) type of this query, used by Elasticsearch for indexing and searching. If the property is empty, the the query will match across all types.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
FieldsA comma-separated list of fields to retrieve from the document. If the Fields property is left blank, then the entire document's source will be retrieved.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
SortA sort parameter (e.g., timestamp:asc). If the Sort property is left blank, then the results will be retrieved in document order.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
LimitIf set, limits the number of results that will be returned.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
TargetFlow file content
  • Flow file content
  • Flow file attributes
Indicates where the results should be placed. In the case of 'Flow file content', the JSON response will be written as the content of the flow file. In the case of 'Flow file attributes', the original flow file (if applicable) will be cloned for each result, and all return fields will be placed in a flow file attribute of the same name, but prefixed by 'es.result.'
Routing Strategy for Query InfoNEVER
  • Always Always route Query Info
  • Never Never route Query Info
  • No Hits Route Query Info if the Query returns no hits
Specifies when to generate and route Query Info after a successful query

Dynamic Properties:

Dynamic Properties allow the user to specify both the name and value of a property.

NameValueDescription
A URL query parameterThe value to set it toAdds the specified property name/value as a query parameter in the Elasticsearch URL used for processing
Supports Expression Language: true (will be evaluated using variable registry only)

Relationships:

NameDescription
retryA FlowFile is routed to this relationship if the document cannot be fetched but attempting the operation again may succeed. Note that if the processor has no incoming connections, flow files may still be sent to this relationship based on the processor properties and the results of the fetch operation.
successAll FlowFiles that are read from Elasticsearch are routed to this relationship.
failureAll FlowFiles that cannot be read from Elasticsearch are routed to this relationship. Note that only incoming flow files will be routed to failure.

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
filenameThe filename attribute is set to the document identifier
es.query.hitcountThe number of hits for a query
es.idThe Elasticsearch document identifier
es.indexThe Elasticsearch index containing the document
es.query.urlThe Elasticsearch query that was built
es.typeThe Elasticsearch document type
es.result.*If Target is 'Flow file attributes', the JSON attributes of each result will be placed into corresponding attributes with this prefix.

State management:

This component does not store state.

Restricted:

This component is not restricted.

Input requirement:

This component allows an incoming relationship.

System Resource Considerations:

None specified.