public class ElasticsearchPersistWriter extends Object implements StreamsPersistWriter, Serializable
Modifier and Type | Field and Description |
---|---|
protected List<String> |
affectedIndexes |
protected org.elasticsearch.action.bulk.BulkRequestBuilder |
bulkRequest |
protected ElasticsearchWriterConfiguration |
config |
protected AtomicLong |
currentBatchBytes |
protected AtomicLong |
currentBatchItems |
protected ElasticsearchClientManager |
manager |
protected static com.fasterxml.jackson.databind.ObjectMapper |
OBJECT_MAPPER |
static String |
STREAMS_ID |
Constructor and Description |
---|
ElasticsearchPersistWriter() |
ElasticsearchPersistWriter(ElasticsearchWriterConfiguration config) |
ElasticsearchPersistWriter(ElasticsearchWriterConfiguration config,
ElasticsearchClientManager manager)
ElasticsearchPersistWriter constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
add(org.elasticsearch.action.index.IndexRequest request) |
void |
add(String indexName,
String type,
String id,
String ts,
String json)
add based on supplied parameters.
|
void |
add(String indexName,
String type,
String id,
String parent,
String routing,
String ts,
String json)
add based on supplied parameters.
|
protected StreamsDatum |
appendMetadata(StreamsDatum streamsDatum) |
protected void |
checkForFlush() |
protected void |
checkIndexImplications(String indexName) |
void |
cleanUp() |
void |
createIndexIfMissing(String indexName)
createIndexIfMissing
|
protected void |
disableRefresh() |
protected String |
docAsJson(Object streamsDocument) |
List<String> |
getAffectedIndexes() |
long |
getBatchesResponded() |
long |
getBatchesSent() |
long |
getFlushThreasholdMaxTime() |
long |
getFlushThresholdBytes() |
long |
getFlushThresholdsRecords() |
String |
getId() |
long |
getTotalFailed() |
long |
getTotalOk() |
long |
getTotalOutstanding() |
long |
getTotalSeconds() |
long |
getTotalSent() |
long |
getTotalSizeInBytes() |
boolean |
isConnected() |
void |
prepare(Object configurationObject) |
void |
setFlushThreasholdMaxTime(long val) |
void |
setFlushThresholdBytes(long val) |
void |
setFlushThresholdRecords(long val) |
void |
setVeryLargeBulk(boolean veryLargeBulk) |
void |
write(StreamsDatum streamsDatum) |
public static final String STREAMS_ID
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
protected final ElasticsearchClientManager manager
protected final ElasticsearchWriterConfiguration config
protected org.elasticsearch.action.bulk.BulkRequestBuilder bulkRequest
protected final AtomicLong currentBatchItems
protected final AtomicLong currentBatchBytes
public ElasticsearchPersistWriter()
public ElasticsearchPersistWriter(ElasticsearchWriterConfiguration config)
public ElasticsearchPersistWriter(ElasticsearchWriterConfiguration config, ElasticsearchClientManager manager)
config
- configmanager
- managerpublic long getBatchesSent()
public long getBatchesResponded()
public long getFlushThresholdsRecords()
public long getFlushThresholdBytes()
public long getFlushThreasholdMaxTime()
public void setFlushThresholdRecords(long val)
public void setFlushThresholdBytes(long val)
public void setFlushThreasholdMaxTime(long val)
public void setVeryLargeBulk(boolean veryLargeBulk)
public long getTotalOutstanding()
public long getTotalSent()
public long getTotalOk()
public long getTotalFailed()
public long getTotalSizeInBytes()
public long getTotalSeconds()
public boolean isConnected()
public String getId()
getId
in interface StreamsOperation
public void write(StreamsDatum streamsDatum)
write
in interface StreamsPersistWriter
protected String docAsJson(Object streamsDocument) throws IOException
IOException
protected StreamsDatum appendMetadata(StreamsDatum streamsDatum) throws IOException
IOException
public void cleanUp()
cleanUp
in interface StreamsOperation
public void add(String indexName, String type, String id, String ts, String json)
indexName
- indexNametype
- typeid
- idts
- tsjson
- jsonpublic void add(String indexName, String type, String id, String parent, String routing, String ts, String json)
indexName
- indexNametype
- typeid
- idrouting
- routingts
- tsjson
- jsonprotected void add(org.elasticsearch.action.index.IndexRequest request)
protected void checkForFlush()
protected void checkIndexImplications(String indexName)
protected void disableRefresh()
public void createIndexIfMissing(String indexName)
indexName
- indexNamepublic void prepare(Object configurationObject)
prepare
in interface StreamsOperation
Copyright © 2018 The Apache Software Foundation. All rights reserved.