T
- The type of the element handled by this IndexRequestBuilder
public interface IndexRequestBuilder<T> extends Function, Serializable
IndexRequest
from an element in a Stream.
This is used by ElasticsearchSink
to prepare elements for sending them to Elasticsearch. See
Index API
for information about how to format data for adding it to an Elasticsearch index.
Example:
private static class MyIndexRequestBuilder implements IndexRequestBuilder<String> {
public IndexRequest createIndexRequest(String element, RuntimeContext ctx) {
Map<String, Object> json = new HashMap<>();
json.put("data", element);
return Requests.indexRequest()
.index("my-index")
.type("my-type")
.source(json);
}
}
Modifier and Type | Method and Description |
---|---|
org.elasticsearch.action.index.IndexRequest |
createIndexRequest(T element,
RuntimeContext ctx)
Creates an
IndexRequest from an element. |
org.elasticsearch.action.index.IndexRequest createIndexRequest(T element, RuntimeContext ctx)
IndexRequest
from an element.element
- The element that needs to be turned in to an IndexRequest
ctx
- The Flink RuntimeContext
of the ElasticsearchSink
IndexRequest
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.