public class IndexRequestBuilder extends ReplicationRequestBuilder<IndexRequest,IndexResponse,IndexRequestBuilder>
action, client, request
Constructor and Description |
---|
IndexRequestBuilder(ElasticsearchClient client,
IndexAction action) |
IndexRequestBuilder(ElasticsearchClient client,
IndexAction action,
String index) |
Modifier and Type | Method and Description |
---|---|
IndexRequestBuilder |
setContentType(XContentType contentType)
The content type that will be used to generate a document from user provided objects (like Map).
|
IndexRequestBuilder |
setCreate(boolean create)
Set to true to force this index to use
IndexRequest.OpType.CREATE . |
IndexRequestBuilder |
setId(String id)
Sets the id to index the document under.
|
IndexRequestBuilder |
setOpType(IndexRequest.OpType opType)
Sets the type of operation to perform.
|
IndexRequestBuilder |
setOpType(String opType)
Sets a string representation of the
setOpType(org.elasticsearch.action.index.IndexRequest.OpType) . |
IndexRequestBuilder |
setParent(String parent)
Sets the parent id of this document.
|
IndexRequestBuilder |
setRefresh(boolean refresh)
Should a refresh be executed post this index operation causing the operation to
be searchable.
|
IndexRequestBuilder |
setRouting(String routing)
Controls the shard routing of the request.
|
IndexRequestBuilder |
setSource(byte[] source)
Sets the document to index in bytes form.
|
IndexRequestBuilder |
setSource(byte[] source,
int offset,
int length)
Sets the document to index in bytes form (assumed to be safe to be used from different
threads).
|
IndexRequestBuilder |
setSource(BytesReference source)
Sets the source.
|
IndexRequestBuilder |
setSource(Map<String,?> source)
Index the Map as a JSON.
|
IndexRequestBuilder |
setSource(Map<String,?> source,
XContentType contentType)
Index the Map as the provided content type.
|
IndexRequestBuilder |
setSource(Object... source)
Constructs a simple document with a field name and value pairs.
|
IndexRequestBuilder |
setSource(String source)
Sets the document source to index.
|
IndexRequestBuilder |
setSource(String field1,
Object value1)
Constructs a simple document with a field and a value.
|
IndexRequestBuilder |
setSource(String field1,
Object value1,
String field2,
Object value2)
Constructs a simple document with a field and value pairs.
|
IndexRequestBuilder |
setSource(String field1,
Object value1,
String field2,
Object value2,
String field3,
Object value3)
Constructs a simple document with a field and value pairs.
|
IndexRequestBuilder |
setSource(String field1,
Object value1,
String field2,
Object value2,
String field3,
Object value3,
String field4,
Object value4)
Constructs a simple document with a field and value pairs.
|
IndexRequestBuilder |
setSource(XContentBuilder sourceBuilder)
Sets the content source to index.
|
IndexRequestBuilder |
setTimestamp(String timestamp)
Sets the timestamp either as millis since the epoch, or, in the configured date format.
|
IndexRequestBuilder |
setTTL(long ttl)
Sets the relative ttl value in milliseconds.
|
IndexRequestBuilder |
setTTL(String ttl)
Sets the ttl value as a time value expression.
|
IndexRequestBuilder |
setTTL(TimeValue ttl)
Sets the ttl as a
TimeValue instance. |
IndexRequestBuilder |
setType(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.
|
setConsistencyLevel, setIndex, setTimeout, setTimeout
beforeExecute, execute, execute, get, get, get, putHeader, request
public IndexRequestBuilder(ElasticsearchClient client, IndexAction action)
public IndexRequestBuilder(ElasticsearchClient client, IndexAction action, @Nullable String index)
public IndexRequestBuilder setType(String type)
public IndexRequestBuilder setId(String id)
public IndexRequestBuilder setRouting(String routing)
public IndexRequestBuilder setParent(String parent)
public IndexRequestBuilder setSource(BytesReference source)
public IndexRequestBuilder setSource(Map<String,?> source)
source
- The map to indexpublic IndexRequestBuilder setSource(Map<String,?> source, XContentType contentType)
source
- The map to indexpublic IndexRequestBuilder setSource(String source)
Note, its preferable to either set it using setSource(org.elasticsearch.common.xcontent.XContentBuilder)
or using the setSource(byte[])
.
public IndexRequestBuilder setSource(XContentBuilder sourceBuilder)
public IndexRequestBuilder setSource(byte[] source)
public IndexRequestBuilder setSource(byte[] source, int offset, int length)
source
- The source to indexoffset
- The offset in the byte arraylength
- The length of the datapublic IndexRequestBuilder setSource(String field1, Object value1)
public IndexRequestBuilder setSource(String field1, Object value1, String field2, Object value2)
public IndexRequestBuilder setSource(String field1, Object value1, String field2, Object value2, String field3, Object value3)
public IndexRequestBuilder setSource(String field1, Object value1, String field2, Object value2, String field3, Object value3, String field4, Object value4)
public IndexRequestBuilder setSource(Object... source)
public IndexRequestBuilder setContentType(XContentType contentType)
public IndexRequestBuilder setOpType(IndexRequest.OpType opType)
public IndexRequestBuilder setOpType(String opType)
setOpType(org.elasticsearch.action.index.IndexRequest.OpType)
. Can
be either "index" or "create".public IndexRequestBuilder setCreate(boolean create)
IndexRequest.OpType.CREATE
.public IndexRequestBuilder setRefresh(boolean refresh)
public IndexRequestBuilder setVersion(long version)
public IndexRequestBuilder setVersionType(VersionType versionType)
VersionType.INTERNAL
.public IndexRequestBuilder setTimestamp(String timestamp)
public IndexRequestBuilder setTTL(String ttl)
public IndexRequestBuilder setTTL(long ttl)
public IndexRequestBuilder setTTL(TimeValue ttl)
TimeValue
instance.Copyright © 2009–2016. All rights reserved.