@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.id",description="The Elasticsearch document identifier") @WritesAttribute(attribute="es.index",description="The Elasticsearch index containing the document") @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.") public class QueryElasticsearchHttp extends AbstractElasticsearchHttpProcessor
| Modifier and Type | Field and Description |
|---|---|
private static String |
ATTRIBUTE_PREFIX |
private static String |
FIELD_INCLUDE_QUERY_PARAM |
static PropertyDescriptor |
FIELDS |
private static String |
FROM_QUERY_PARAM |
static PropertyDescriptor |
INDEX |
static PropertyDescriptor |
LIMIT |
static PropertyDescriptor |
PAGE_SIZE |
static PropertyDescriptor |
QUERY |
private static String |
QUERY_QUERY_PARAM |
static Relationship |
REL_FAILURE |
static Relationship |
REL_RETRY |
static Relationship |
REL_SUCCESS |
private static String |
SIZE_QUERY_PARAM |
static PropertyDescriptor |
SORT |
private static String |
SORT_QUERY_PARAM |
static PropertyDescriptor |
TARGET |
static String |
TARGET_FLOW_FILE_ATTRIBUTES |
static String |
TARGET_FLOW_FILE_CONTENT |
static PropertyDescriptor |
TYPE |
CONNECT_TIMEOUT, ES_URL, PROXY_HOST, PROXY_PORT, RESPONSE_TIMEOUTCHARSET, 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) |
private int |
getPage(okhttp3.Response getResponse,
URL url,
ProcessContext context,
ProcessSession session,
FlowFile flowFile,
ComponentLog logger,
long startNanos,
boolean targetIsContent) |
Set<Relationship> |
getRelationships() |
List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
void |
setup(ProcessContext context) |
createElasticsearchClient, customValidate, getClient, isSuccess, parseJsonResponse, sendRequestToElasticsearchonTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprivate static final String FIELD_INCLUDE_QUERY_PARAM
private static final String QUERY_QUERY_PARAM
private static final String SORT_QUERY_PARAM
private static final String FROM_QUERY_PARAM
private static final String SIZE_QUERY_PARAM
public static final String TARGET_FLOW_FILE_CONTENT
public static final String TARGET_FLOW_FILE_ATTRIBUTES
private static final String ATTRIBUTE_PREFIX
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
public static final Relationship REL_RETRY
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 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 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)
throws IOException
IOExceptionprivate URL buildRequestURL(String baseUrl, String query, String index, String type, String fields, String sort, int pageSize, int fromIndex) throws MalformedURLException
MalformedURLExceptionCopyright © 2017 Apache NiFi Project. All rights reserved.