@InputRequirement(value=INPUT_ALLOWED) @EventDriven @SupportsBatching @Tags(value={"elasticsearch","query","read","get","http"}) @CapabilityDescription(value="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.") @WritesAttribute(attribute="filename",description="The filename attribute is set to the document identifier") @WritesAttribute(attribute="es.query.hitcount",description="The number of hits for a query") @WritesAttribute(attribute="es.id",description="The Elasticsearch document identifier") @WritesAttribute(attribute="es.index",description="The Elasticsearch index containing the document") @WritesAttribute(attribute="es.query.url",description="The Elasticsearch query that was built") @WritesAttribute(attribute="es.type",description="The Elasticsearch document type") @WritesAttribute(attribute="es.result.*",description="If Target is \'Flow file attributes\', the JSON attributes of each result will be placed into corresponding attributes with this prefix.") @DynamicProperty(name="A URL query parameter", value="The value to set it to", expressionLanguageScope=VARIABLE_REGISTRY, description="Adds the specified property name/value as a query parameter in the Elasticsearch URL used for processing") public class QueryElasticsearchHttp extends AbstractElasticsearchHttpProcessor
| Modifier and Type | Class and Description |
|---|---|
static class |
QueryElasticsearchHttp.QueryInfoRouteStrategy |
| Modifier and Type | Field and Description |
|---|---|
(package private) static AllowableValue |
ALWAYS |
private static String |
ATTRIBUTE_PREFIX |
static PropertyDescriptor |
FIELDS |
private static String |
FROM_QUERY_PARAM |
static PropertyDescriptor |
INDEX |
static PropertyDescriptor |
LIMIT |
(package private) static AllowableValue |
NEVER |
(package private) static AllowableValue |
NO_HITS |
static PropertyDescriptor |
PAGE_SIZE |
private static List<PropertyDescriptor> |
propertyDescriptors |
static PropertyDescriptor |
QUERY |
private QueryElasticsearchHttp.QueryInfoRouteStrategy |
queryInfoRouteStrategy |
static Relationship |
REL_FAILURE |
static Relationship |
REL_QUERY_INFO |
static Relationship |
REL_RETRY |
static Relationship |
REL_SUCCESS |
private Set<Relationship> |
relationships |
static PropertyDescriptor |
ROUTING_QUERY_INFO_STRATEGY |
static PropertyDescriptor |
SORT |
static PropertyDescriptor |
TARGET |
static String |
TARGET_FLOW_FILE_ATTRIBUTES |
static String |
TARGET_FLOW_FILE_CONTENT |
static PropertyDescriptor |
TYPE |
COMMON_PROPERTY_DESCRIPTORS, CONNECT_TIMEOUT, ES_URL, FIELD_INCLUDE_QUERY_PARAM, PROXY_CONFIGURATION_SERVICE, PROXY_HOST, PROXY_PASSWORD, PROXY_PORT, PROXY_USERNAME, QUERY_QUERY_PARAM, RESPONSE_TIMEOUT, SIZE_QUERY_PARAM, SORT_QUERY_PARAMCHARSET, PASSWORD, PROP_SSL_CONTEXT_SERVICE, USERNAME| Constructor and Description |
|---|
QueryElasticsearchHttp() |
| Modifier and Type | Method and Description |
|---|---|
private URL |
buildRequestURL(String baseUrl,
String query,
String index,
String type,
String fields,
String sort,
int pageSize,
int fromIndex,
ProcessContext context) |
private int |
getPage(okhttp3.Response getResponse,
URL url,
ProcessContext context,
ProcessSession session,
FlowFile flowFile,
ComponentLog logger,
long startNanos,
boolean targetIsContent,
int priorResultCount) |
Set<Relationship> |
getRelationships() |
List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
void |
onPropertyModified(PropertyDescriptor descriptor,
String oldValue,
String newValue) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
void |
setup(ProcessContext context) |
buildBulkCommand, createElasticsearchClient, customValidate, getClient, getSupportedDynamicPropertyDescriptor, isSuccess, parseJsonResponse, sendRequestToElasticsearchonTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, hashCode, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetPropertyDescriptor, getPropertyDescriptors, validateprivate static final String FROM_QUERY_PARAM
public static final String TARGET_FLOW_FILE_CONTENT
public static final String TARGET_FLOW_FILE_ATTRIBUTES
private static final String ATTRIBUTE_PREFIX
static final AllowableValue ALWAYS
static final AllowableValue NEVER
static final AllowableValue NO_HITS
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
public static final Relationship REL_RETRY
public static final Relationship REL_QUERY_INFO
public static final PropertyDescriptor QUERY
public static final PropertyDescriptor INDEX
public static final PropertyDescriptor TYPE
public static final PropertyDescriptor FIELDS
public static final PropertyDescriptor SORT
public static final PropertyDescriptor PAGE_SIZE
public static final PropertyDescriptor LIMIT
public static final PropertyDescriptor TARGET
public static final PropertyDescriptor ROUTING_QUERY_INFO_STRATEGY
private volatile Set<Relationship> relationships
private static final List<PropertyDescriptor> propertyDescriptors
private QueryElasticsearchHttp.QueryInfoRouteStrategy queryInfoRouteStrategy
public Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorpublic final List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponent@OnScheduled public void setup(ProcessContext context)
setup in class AbstractElasticsearchProcessorpublic void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)
onPropertyModified in interface ConfigurableComponentonPropertyModified in class AbstractConfigurableComponentpublic void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionprivate int getPage(okhttp3.Response getResponse,
URL url,
ProcessContext context,
ProcessSession session,
FlowFile flowFile,
ComponentLog logger,
long startNanos,
boolean targetIsContent,
int priorResultCount)
throws IOException
IOExceptionprivate URL buildRequestURL(String baseUrl, String query, String index, String type, String fields, String sort, int pageSize, int fromIndex, ProcessContext context) throws MalformedURLException
MalformedURLExceptionCopyright © 2018 Apache NiFi Project. All rights reserved.