public abstract static class ElasticsearchIO.DocToBulk extends PTransform<PCollection<java.lang.String>,PCollection<ElasticsearchIO.Document>>
PTransform
converting docs to their Bulk API counterparts.annotations, displayData, name, resourceHints
Constructor and Description |
---|
DocToBulk() |
Modifier and Type | Method and Description |
---|---|
PCollection<ElasticsearchIO.Document> |
expand(PCollection<java.lang.String> docs)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
ElasticsearchIO.DocToBulk |
withAppendOnly(boolean appendOnly)
Provide an instruction to control whether the target index should be considered append-only.
|
ElasticsearchIO.DocToBulk |
withBackendVersion(int backendVersion)
Use to set explicitly which version of Elasticsearch the destination cluster is running.
|
ElasticsearchIO.DocToBulk |
withConnectionConfiguration(ElasticsearchIO.ConnectionConfiguration connectionConfiguration)
Provide the Elasticsearch connection configuration object.
|
ElasticsearchIO.DocToBulk |
withDocVersionFn(ElasticsearchIO.Write.FieldValueExtractFn docVersionFn)
Provide a function to extract the doc version from the document.
|
ElasticsearchIO.DocToBulk |
withDocVersionType(java.lang.String docVersionType)
Provide a function to extract the doc version from the document.
|
ElasticsearchIO.DocToBulk |
withIdFn(ElasticsearchIO.Write.FieldValueExtractFn idFn)
Provide a function to extract the id from the document.
|
ElasticsearchIO.DocToBulk |
withIndexFn(ElasticsearchIO.Write.FieldValueExtractFn indexFn)
Provide a function to extract the target index from the document allowing for dynamic
document routing.
|
ElasticsearchIO.DocToBulk |
withIsDeleteFn(ElasticsearchIO.Write.BooleanFieldValueExtractFn isDeleteFn)
Provide a function to extract the target operation either upsert or delete from the document
fields allowing dynamic bulk operation decision.
|
ElasticsearchIO.DocToBulk |
withRoutingFn(ElasticsearchIO.Write.FieldValueExtractFn routingFn)
Provide a function to extract the target routing from the document allowing for dynamic
document routing.
|
ElasticsearchIO.DocToBulk |
withTypeFn(ElasticsearchIO.Write.FieldValueExtractFn typeFn)
Provide a function to extract the target type from the document allowing for dynamic document
routing.
|
ElasticsearchIO.DocToBulk |
withUpsertScript(java.lang.String source)
Whether to use scripted updates and what script to use.
|
ElasticsearchIO.DocToBulk |
withUsePartialUpdate(boolean usePartialUpdate)
Provide an instruction to control whether partial updates or inserts (default) are issued to
Elasticsearch.
|
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
public ElasticsearchIO.DocToBulk withConnectionConfiguration(ElasticsearchIO.ConnectionConfiguration connectionConfiguration)
connectionConfiguration
- the Elasticsearch ElasticsearchIO.ConnectionConfiguration
objectElasticsearchIO.DocToBulk
with connection configuration setpublic ElasticsearchIO.DocToBulk withIdFn(ElasticsearchIO.Write.FieldValueExtractFn idFn)
idFn
- to extract the document IDElasticsearchIO.DocToBulk
with the function setpublic ElasticsearchIO.DocToBulk withIndexFn(ElasticsearchIO.Write.FieldValueExtractFn indexFn)
indexFn
- to extract the destination index fromElasticsearchIO.DocToBulk
with the function setpublic ElasticsearchIO.DocToBulk withRoutingFn(ElasticsearchIO.Write.FieldValueExtractFn routingFn)
routingFn
- to extract the destination index fromElasticsearchIO.DocToBulk
with the function setpublic ElasticsearchIO.DocToBulk withTypeFn(ElasticsearchIO.Write.FieldValueExtractFn typeFn)
typeFn
- to extract the destination index fromElasticsearchIO.DocToBulk
with the function setpublic ElasticsearchIO.DocToBulk withUsePartialUpdate(boolean usePartialUpdate)
usePartialUpdate
- set to true to issue partial updatesElasticsearchIO.DocToBulk
with the partial update control setpublic ElasticsearchIO.DocToBulk withAppendOnly(boolean appendOnly)
create
operations will be issued,
instead of index
, which is the default.
create
fails if a document with the same ID already exists in the target, index
adds or replaces a document as necessary. If no ID is provided, both operations are
equivalent, unless you are writing to a data
stream. Data streams only support the create
operation. For more information see
the Parameters:
appendOnly
- set to true to allow only document appendingElasticsearchIO.DocToBulk
with the-append only control set
public ElasticsearchIO.DocToBulk withUpsertScript(java.lang.String source)
source
- set to the value of the script source, painless langElasticsearchIO.DocToBulk
with the scripted updates setpublic ElasticsearchIO.DocToBulk withDocVersionFn(ElasticsearchIO.Write.FieldValueExtractFn docVersionFn)
docVersionFn
- to extract the document versionElasticsearchIO.DocToBulk
with the function setpublic ElasticsearchIO.DocToBulk withIsDeleteFn(ElasticsearchIO.Write.BooleanFieldValueExtractFn isDeleteFn)
isDeleteFn
- set to true for deleting the specific documentElasticsearchIO.Write
with the function setpublic ElasticsearchIO.DocToBulk withDocVersionType(java.lang.String docVersionType)
docVersionType
- the version type to use, one of ElasticsearchIO.DocToBulk
with the doc version type setpublic ElasticsearchIO.DocToBulk withBackendVersion(int backendVersion)
withConnectionConfiguration(org.apache.beam.sdk.io.elasticsearch.ElasticsearchIO.ConnectionConfiguration)
. This can also be very useful for testing purposes.
Note: if the value of @param backendVersion differs from the version the destination cluster is running, behavior is undefined and likely to yield errors.
backendVersion
- the major version number of the version of Elasticsearch being run in
the cluster where documents will be indexed.ElasticsearchIO.DocToBulk
with the Elasticsearch major version number setpublic PCollection<ElasticsearchIO.Document> expand(PCollection<java.lang.String> docs)
PTransform
PTransform
should be expanded on the given
InputT
.
NOTE: This method should not be called directly. Instead apply the PTransform
should
be applied to the InputT
using the apply
method.
Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
expand
in class PTransform<PCollection<java.lang.String>,PCollection<ElasticsearchIO.Document>>