public class IndexRequestBuilder extends ReplicationRequestBuilder<IndexRequest,IndexResponse,IndexRequestBuilder> implements WriteRequestBuilder<IndexRequestBuilder>
action, client, request
Constructor and Description |
---|
IndexRequestBuilder(ElasticsearchClient client,
IndexAction action) |
IndexRequestBuilder(ElasticsearchClient client,
IndexAction action,
java.lang.String index) |
Modifier and Type | Method and Description |
---|---|
IndexRequestBuilder |
setCreate(boolean create)
Set to true to force this index to use
org.elasticsearch.action.index.IndexRequest.OpType#CREATE . |
IndexRequestBuilder |
setId(java.lang.String id)
Sets the id to index the document under.
|
IndexRequestBuilder |
setOpType(DocWriteRequest.OpType opType)
Sets the type of operation to perform.
|
IndexRequestBuilder |
setParent(java.lang.String parent)
Sets the parent id of this document.
|
IndexRequestBuilder |
setPipeline(java.lang.String pipeline)
Sets the ingest pipeline to be executed before indexing the document
|
IndexRequestBuilder |
setRouting(java.lang.String routing)
Controls the shard routing of the request.
|
IndexRequestBuilder |
setSource(byte[] source,
int offset,
int length,
XContentType xContentType)
Sets the document to index in bytes form (assumed to be safe to be used from different
threads).
|
IndexRequestBuilder |
setSource(byte[] source,
XContentType xContentType)
Sets the document to index in bytes form.
|
IndexRequestBuilder |
setSource(BytesReference source,
XContentType xContentType)
Sets the source.
|
IndexRequestBuilder |
setSource(java.util.Map<java.lang.String,?> source)
Index the Map as a JSON.
|
IndexRequestBuilder |
setSource(java.util.Map<java.lang.String,?> source,
XContentType contentType)
Index the Map as the provided content type.
|
IndexRequestBuilder |
setSource(java.lang.Object... source)
Constructs a simple document with a field name and value pairs.
|
IndexRequestBuilder |
setSource(java.lang.String source,
XContentType xContentType)
Sets the document source to index.
|
IndexRequestBuilder |
setSource(XContentBuilder sourceBuilder)
Sets the content source to index.
|
IndexRequestBuilder |
setSource(XContentType xContentType,
java.lang.Object... source)
Constructs a simple document with a field name and value pairs.
|
IndexRequestBuilder |
setType(java.lang.String type)
Sets the type to index the document to.
|
IndexRequestBuilder |
setVersion(long version)
Sets the version, which will cause the index operation to only be performed if a matching
version exists and no changes happened on the doc since then.
|
IndexRequestBuilder |
setVersionType(VersionType versionType)
Sets the versioning type.
|
setIndex, setTimeout, setTimeout, setWaitForActiveShards, setWaitForActiveShards
execute, execute, get, get, get, request
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
request, setRefreshPolicy, setRefreshPolicy
public IndexRequestBuilder(ElasticsearchClient client, IndexAction action)
public IndexRequestBuilder(ElasticsearchClient client, IndexAction action, @Nullable java.lang.String index)
public IndexRequestBuilder setType(java.lang.String type)
public IndexRequestBuilder setId(java.lang.String id)
public IndexRequestBuilder setRouting(java.lang.String routing)
public IndexRequestBuilder setParent(java.lang.String parent)
public IndexRequestBuilder setSource(BytesReference source, XContentType xContentType)
public IndexRequestBuilder setSource(java.util.Map<java.lang.String,?> source)
source
- The map to indexpublic IndexRequestBuilder setSource(java.util.Map<java.lang.String,?> source, XContentType contentType)
source
- The map to indexpublic IndexRequestBuilder setSource(java.lang.String source, XContentType xContentType)
Note, its preferable to either set it using setSource(org.elasticsearch.common.xcontent.XContentBuilder)
or using the setSource(byte[], XContentType)
.
public IndexRequestBuilder setSource(XContentBuilder sourceBuilder)
public IndexRequestBuilder setSource(byte[] source, XContentType xContentType)
public IndexRequestBuilder setSource(byte[] source, int offset, int length, XContentType xContentType)
source
- The source to indexoffset
- The offset in the byte arraylength
- The length of the dataxContentType
- The type/format of the sourcepublic IndexRequestBuilder setSource(java.lang.Object... source)
Note: the number of objects passed to this method must be an even number. Also the first argument in each pair (the field name) must have a valid String representation.
public IndexRequestBuilder setSource(XContentType xContentType, java.lang.Object... source)
Note: the number of objects passed as varargs to this method must be an even number. Also the first argument in each pair (the field name) must have a valid String representation.
public IndexRequestBuilder setOpType(DocWriteRequest.OpType opType)
public IndexRequestBuilder setCreate(boolean create)
org.elasticsearch.action.index.IndexRequest.OpType#CREATE
.public IndexRequestBuilder setVersion(long version)
public IndexRequestBuilder setVersionType(VersionType versionType)
VersionType.INTERNAL
.public IndexRequestBuilder setPipeline(java.lang.String pipeline)