Class BulkOperation
- java.lang.Object
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageProducer
,AdaptrisMessageSender
,AdaptrisMessageWorker
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
@ComponentProfile(summary="Use the REST API to interact with Elasticsearch", tag="producer,elastic,bulk,batch", recommended=ElasticRestConnection.class) public class BulkOperation extends SingleOperation
Index/Delete/Update a document(s) to ElasticSearch.ElasticRestProducer.getIndex()
should return the index that the documents will be inserted against ElasticSearch; thetype
is taken from the DocumentBuilderThe action for each document is driven by the configured
ActionExtractor
instance. In the event of anDocumentAction.UPSERT
action then the sameXContentBuilder
from theDocumentWrapper
is used as both the update and upsert document viadoc(XContentBuilder
} andupsert(XContentBuilder)
. This makes the assumption that the document generated contains all the data required, not just a subset. If in doubt; stick to a normalDocumentAction.UPDATE
which will throw aDocumentMissingException
failing the messages.In the adapter configuration file this class is aliased as elastic-rest-bulk-operation which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.elastic.rest.SingleOperation
requestBuilder
-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description BulkOperation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AdaptrisMessage
doRequest(AdaptrisMessage msg, java.lang.String index, long timeout)
java.lang.Integer
getBatchWindow()
The batch window which is the number of operations that make a bulk request before its executed.void
setBatchWindow(java.lang.Integer batchWindow)
The batch window which is the number of operations that make a bulk request before its executed.BulkOperation
withBatchWindow(java.lang.Integer i)
-
Methods inherited from class com.adaptris.core.elastic.rest.SingleOperation
actionExtractor, getAction, getDocumentBuilder, getRefreshPolicy, setAction, setDocumentBuilder, setRefreshPolicy, withAction, withDocumentBuilder, withRefreshPolicy
-
Methods inherited from class com.adaptris.core.elastic.rest.ElasticRestProducer
defaultTimeout, doProduce, endpoint, getIndex, prepare, setIndex, withIndex
-
Methods inherited from class com.adaptris.core.RequestReplyProducerImp
produce, request, request
-
Methods inherited from class com.adaptris.core.RequestReplyProducerBase
copyReplyContents, getIgnoreReplyMetadata, mergeReply, setIgnoreReplyMetadata
-
Methods inherited from class com.adaptris.core.AdaptrisMessageProducerImp
createName
-
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init, start, stop
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createQualifier, isTrackingEndpoint
-
-
-
-
Method Detail
-
doRequest
protected AdaptrisMessage doRequest(AdaptrisMessage msg, java.lang.String index, long timeout) throws ProduceException
- Overrides:
doRequest
in classSingleOperation
- Throws:
ProduceException
-
withBatchWindow
public BulkOperation withBatchWindow(java.lang.Integer i)
-
getBatchWindow
public java.lang.Integer getBatchWindow()
The batch window which is the number of operations that make a bulk request before its executed.If not specified explicitly then the default is 10000
-
setBatchWindow
public void setBatchWindow(java.lang.Integer batchWindow)
The batch window which is the number of operations that make a bulk request before its executed.If not specified explicitly then the default is 10000
-
-