public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder<IndexRequest,IndexResponse,IndexRequestBuilder>
client, request
Constructor and Description |
---|
IndexRequestBuilder(Client client) |
IndexRequestBuilder(Client client,
String index) |
Modifier and Type | Method and Description |
---|---|
protected void |
doExecute(ActionListener<IndexResponse> listener) |
IndexRequestBuilder |
setConsistencyLevel(WriteConsistencyLevel consistencyLevel)
Sets the consistency level.
|
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 |
setReplicationType(ReplicationType replicationType)
Set the replication type for this operation.
|
IndexRequestBuilder |
setReplicationType(String replicationType)
Set the replication type for this operation.
|
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(byte[] source,
int offset,
int length,
boolean unsafe)
Sets the document to index in bytes form.
|
IndexRequestBuilder |
setSource(BytesReference source)
Sets the source.
|
IndexRequestBuilder |
setSource(BytesReference source,
boolean unsafe)
Sets the source.
|
IndexRequestBuilder |
setSource(Map<String,Object> source)
Index the Map as a JSON.
|
IndexRequestBuilder |
setSource(Map<String,Object> 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) |
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.
|
setIndex, setOperationThreaded, setTimeout, setTimeout
execute, execute, get, get, get, putHeader, request, setListenerThreaded
public IndexRequestBuilder(Client client)
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, boolean unsafe)
public IndexRequestBuilder setSource(BytesReference source)
public IndexRequestBuilder setSource(Map<String,Object> source)
source
- The map to indexpublic IndexRequestBuilder setSource(Map<String,Object> 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(byte[] source, int offset, int length, boolean unsafe)
source
- The source to indexoffset
- The offset in the byte arraylength
- The length of the dataunsafe
- Is the byte array safe to be used form a different threadpublic 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 setReplicationType(ReplicationType replicationType)
public IndexRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel)
WriteConsistencyLevel.DEFAULT
.public IndexRequestBuilder setReplicationType(String replicationType)
public IndexRequestBuilder setVersion(long version)
public IndexRequestBuilder setVersionType(VersionType versionType)
VersionType.INTERNAL
.public IndexRequestBuilder setTimestamp(String timestamp)
public IndexRequestBuilder setTTL(long ttl)
protected void doExecute(ActionListener<IndexResponse> listener)
doExecute
in class ActionRequestBuilder<IndexRequest,IndexResponse,IndexRequestBuilder,Client>
Copyright © 2009–2015. All rights reserved.