public class PutIndexedScriptRequest extends ActionRequest<PutIndexedScriptRequest> implements IndicesRequest
The request requires the scriptLang(String)
, id(String)
and
source(byte[])
to be set.
The source (content to index) can be set in its bytes form using (source()
(byte[])}),
its string form (source(String)
) or using a XContentBuilder
(source(org.elasticsearch.common.xcontent.XContentBuilder)
).
If the id(String)
is not set, it will be automatically generated.
PutIndexedScriptResponse
TransportRequest.Empty
IndicesRequest.Replaceable
headers
Constructor and Description |
---|
PutIndexedScriptRequest() |
PutIndexedScriptRequest(String scriptLang)
Constructs a new index request against the specific index and type.
|
PutIndexedScriptRequest(String scriptLang,
String id)
Constructs a new index request against the index, type, id and using the source.
|
Modifier and Type | Method and Description |
---|---|
PutIndexedScriptRequest |
contentType(XContentType contentType)
Sets the content type that will be used when generating a document from user provided objects (like Map).
|
PutIndexedScriptRequest |
create(boolean create)
Set to true to force this index to use
IndexRequest.OpType.CREATE . |
String |
id()
The id of the indexed document.
|
PutIndexedScriptRequest |
id(String id)
Sets the id of the indexed document.
|
String[] |
indices()
Returns the array of indices that the action relates to
|
IndicesOptions |
indicesOptions()
Returns the indices options used to resolve indices.
|
IndexRequest.OpType |
opType()
The type of operation to perform.
|
PutIndexedScriptRequest |
opType(IndexRequest.OpType opType)
Sets the type of operation to perform.
|
void |
readFrom(StreamInput in) |
String |
scriptLang()
The type of the indexed document.
|
PutIndexedScriptRequest |
scriptLang(String scriptLang)
Sets the type of the indexed document.
|
BytesReference |
source()
The source of the document to index, recopied to a new array if it is unsage.
|
PutIndexedScriptRequest |
source(byte[] source)
Sets the document to index in bytes form.
|
PutIndexedScriptRequest |
source(byte[] source,
int offset,
int length)
Sets the document to index in bytes form (assumed to be safe to be used from different
threads).
|
PutIndexedScriptRequest |
source(BytesReference source)
Sets the document to index in bytes form.
|
PutIndexedScriptRequest |
source(Map source)
Index the Map as a
Requests.INDEX_CONTENT_TYPE . |
PutIndexedScriptRequest |
source(Map source,
XContentType contentType)
Index the Map as the provided content type.
|
PutIndexedScriptRequest |
source(Object... source) |
PutIndexedScriptRequest |
source(String source)
Sets the document source to index.
|
PutIndexedScriptRequest |
source(XContentBuilder sourceBuilder)
Sets the content source to index.
|
Map<String,Object> |
sourceAsMap() |
String |
toString() |
ActionRequestValidationException |
validate() |
long |
version() |
PutIndexedScriptRequest |
version(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.
|
VersionType |
versionType() |
PutIndexedScriptRequest |
versionType(VersionType versionType)
Sets the versioning type.
|
void |
writeTo(StreamOutput out) |
createTask, getDescription
remoteAddress, remoteAddress
contextSize, copyContextAndHeadersFrom, copyContextFrom, copyHeadersFrom, getContext, getFromContext, getFromContext, getHeader, getHeaders, hasHeader, hasInContext, isContextEmpty, putAllInContext, putHeader, putInContext
public PutIndexedScriptRequest()
public PutIndexedScriptRequest(String scriptLang)
source(byte[])
must be set.public ActionRequestValidationException validate()
validate
in class ActionRequest<PutIndexedScriptRequest>
public String[] indices()
IndicesRequest
indices
in interface IndicesRequest
public IndicesOptions indicesOptions()
IndicesRequest
indicesOptions
in interface IndicesRequest
public PutIndexedScriptRequest contentType(XContentType contentType)
public String scriptLang()
public PutIndexedScriptRequest scriptLang(String scriptLang)
public String id()
public PutIndexedScriptRequest id(String id)
public BytesReference source()
public PutIndexedScriptRequest source(Map source) throws ElasticsearchGenerationException
Requests.INDEX_CONTENT_TYPE
.source
- The map to indexElasticsearchGenerationException
public PutIndexedScriptRequest source(Map source, XContentType contentType) throws ElasticsearchGenerationException
source
- The map to indexElasticsearchGenerationException
public PutIndexedScriptRequest source(String source)
Note, its preferable to either set it using source(org.elasticsearch.common.xcontent.XContentBuilder)
or using the source(byte[])
.
public PutIndexedScriptRequest source(XContentBuilder sourceBuilder)
public PutIndexedScriptRequest source(Object... source)
public PutIndexedScriptRequest source(BytesReference source)
public PutIndexedScriptRequest source(byte[] source)
public PutIndexedScriptRequest source(byte[] source, int offset, int length)
source
- The source to indexoffset
- The offset in the byte arraylength
- The length of the datapublic PutIndexedScriptRequest opType(IndexRequest.OpType opType)
public PutIndexedScriptRequest create(boolean create)
IndexRequest.OpType.CREATE
.public IndexRequest.OpType opType()
public PutIndexedScriptRequest version(long version)
public long version()
public PutIndexedScriptRequest versionType(VersionType versionType)
VersionType.INTERNAL
.public VersionType versionType()
public void readFrom(StreamInput in) throws IOException
readFrom
in interface Streamable
readFrom
in class ActionRequest<PutIndexedScriptRequest>
IOException
public void writeTo(StreamOutput out) throws IOException
writeTo
in interface Streamable
writeTo
in class ActionRequest<PutIndexedScriptRequest>
IOException
Copyright © 2009–2016. All rights reserved.