Remove HLRC docs and related integration tests. (#81358)

The HLRC will no longer be published from 8.0.0 and onwards.
Also the HLRC docs are no longer published, so these can be removed now.

The HLRC is currently used in a number of java rest tests and
for this reason it can't be removed completely.

Closes #81299
This commit is contained in:
Martijn van Groningen 2021-12-17 07:39:14 +01:00 committed by GitHub
parent f03fa87c74
commit eec64f72bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
303 changed files with 6 additions and 41823 deletions

View file

@ -1,84 +0,0 @@
[[java-rest-high-aggregation-builders]]
=== Building Aggregations
This page lists all the available aggregations with their corresponding `AggregationBuilder` class name and helper method name in the
`AggregationBuilders` or `PipelineAggregatorBuilders` utility classes.
:agg-ref: {elasticsearch-javadoc}/org/elasticsearch/search/aggregations
:parentjoin-ref: {parent-join-client-javadoc}/org/elasticsearch/join/aggregations
:matrixstats-ref: {matrixstats-client-javadoc}/org/elasticsearch/search/aggregations
==== Metrics Aggregations
[options="header"]
|======
| Aggregation | AggregationBuilder Class | Method in AggregationBuilders
| {ref}/search-aggregations-metrics-avg-aggregation.html[Avg] | {agg-ref}/metrics/AvgAggregationBuilder.html[AvgAggregationBuilder] | {agg-ref}/AggregationBuilders.html#avg-java.lang.String-[AggregationBuilders.avg()]
| {ref}/search-aggregations-metrics-cardinality-aggregation.html[Cardinality] | {agg-ref}/metrics/CardinalityAggregationBuilder.html[CardinalityAggregationBuilder] | {agg-ref}/AggregationBuilders.html#cardinality-java.lang.String-[AggregationBuilders.cardinality()]
| {ref}/search-aggregations-metrics-extendedstats-aggregation.html[Extended Stats] | {agg-ref}/metrics/ExtendedStatsAggregationBuilder.html[ExtendedStatsAggregationBuilder] | {agg-ref}/AggregationBuilders.html#extendedStats-java.lang.String-[AggregationBuilders.extendedStats()]
| {ref}/search-aggregations-metrics-geobounds-aggregation.html[Geo Bounds] | {agg-ref}/metrics/GeoBoundsAggregationBuilder.html[GeoBoundsAggregationBuilder] | {agg-ref}/AggregationBuilders.html#geoBounds-java.lang.String-[AggregationBuilders.geoBounds()]
| {ref}/search-aggregations-metrics-geocentroid-aggregation.html[Geo Centroid] | {agg-ref}/metrics/GeoCentroidAggregationBuilder.html[GeoCentroidAggregationBuilder] | {agg-ref}/AggregationBuilders.html#geoCentroid-java.lang.String-[AggregationBuilders.geoCentroid()]
| {ref}/search-aggregations-metrics-max-aggregation.html[Max] | {agg-ref}/metrics/MaxAggregationBuilder.html[MaxAggregationBuilder] | {agg-ref}/AggregationBuilders.html#max-java.lang.String-[AggregationBuilders.max()]
| {ref}/search-aggregations-metrics-min-aggregation.html[Min] | {agg-ref}/metrics/MinAggregationBuilder.html[MinAggregationBuilder] | {agg-ref}/AggregationBuilders.html#min-java.lang.String-[AggregationBuilders.min()]
| {ref}/search-aggregations-metrics-percentile-aggregation.html[Percentiles] | {agg-ref}/metrics/PercentilesAggregationBuilder.html[PercentilesAggregationBuilder] | {agg-ref}/AggregationBuilders.html#percentiles-java.lang.String-[AggregationBuilders.percentiles()]
| {ref}/search-aggregations-metrics-percentile-rank-aggregation.html[Percentile Ranks] | {agg-ref}/metrics/PercentileRanksAggregationBuilder.html[PercentileRanksAggregationBuilder] | {agg-ref}/AggregationBuilders.html#percentileRanks-java.lang.String-[AggregationBuilders.percentileRanks()]
| {ref}/search-aggregations-metrics-scripted-metric-aggregation.html[Scripted Metric] | {agg-ref}/metrics/ScriptedMetricAggregationBuilder.html[ScriptedMetricAggregationBuilder] | {agg-ref}/AggregationBuilders.html#scriptedMetric-java.lang.String-[AggregationBuilders.scriptedMetric()]
| {ref}/search-aggregations-metrics-stats-aggregation.html[Stats] | {agg-ref}/metrics/StatsAggregationBuilder.html[StatsAggregationBuilder] | {agg-ref}/AggregationBuilders.html#stats-java.lang.String-[AggregationBuilders.stats()]
| {ref}/search-aggregations-metrics-sum-aggregation.html[Sum] | {agg-ref}/metrics/SumAggregationBuilder.html[SumAggregationBuilder] | {agg-ref}/AggregationBuilders.html#sum-java.lang.String-[AggregationBuilders.sum()]
| {ref}/search-aggregations-metrics-top-hits-aggregation.html[Top hits] | {agg-ref}/metrics/TopHitsAggregationBuilder.html[TopHitsAggregationBuilder] | {agg-ref}/AggregationBuilders.html#topHits-java.lang.String-[AggregationBuilders.topHits()]
| {ref}/search-aggregations-metrics-top-metrics.html[Top Metrics] | {javadoc-client}/analytics/TopMetricsAggregationBuilder.html[TopMetricsAggregationBuilder] | None
| {ref}/search-aggregations-metrics-valuecount-aggregation.html[Value Count] | {agg-ref}/metrics/ValueCountAggregationBuilder.html[ValueCountAggregationBuilder] | {agg-ref}/AggregationBuilders.html#count-java.lang.String-[AggregationBuilders.count()]
| {ref}/search-aggregations-metrics-string-stats-aggregation.html[String Stats] | {javadoc-client}/analytics/StringStatsAggregationBuilder.html[StringStatsAggregationBuilder] | None
|======
==== Bucket Aggregations
[options="header"]
|======
| Aggregation | AggregationBuilder Class | Method in AggregationBuilders
| {ref}/search-aggregations-bucket-adjacency-matrix-aggregation.html[Adjacency Matrix] | {agg-ref}/bucket/adjacency/AdjacencyMatrixAggregationBuilder.html[AdjacencyMatrixAggregationBuilder] | {agg-ref}/AggregationBuilders.html#adjacencyMatrix-java.lang.String-java.util.Map-[AggregationBuilders.adjacencyMatrix()]
| {ref}/search-aggregations-bucket-children-aggregation.html[Children] | {parentjoin-ref}/ChildrenAggregationBuilder.html[ChildrenAggregationBuilder] |
| {ref}/search-aggregations-bucket-datehistogram-aggregation.html[Date Histogram] | {agg-ref}/bucket/histogram/DateHistogramAggregationBuilder.html[DateHistogramAggregationBuilder] | {agg-ref}/AggregationBuilders.html#dateHistogram-java.lang.String-[AggregationBuilders.dateHistogram()]
| {ref}/search-aggregations-bucket-daterange-aggregation.html[Date Range] | {agg-ref}/bucket/range/DateRangeAggregationBuilder.html[DateRangeAggregationBuilder] | {agg-ref}/AggregationBuilders.html#dateRange-java.lang.String-[AggregationBuilders.dateRange()]
| {ref}/search-aggregations-bucket-diversified-sampler-aggregation.html[Diversified Sampler] | {agg-ref}/bucket/sampler/DiversifiedAggregationBuilder.html[DiversifiedAggregationBuilder] | {agg-ref}/AggregationBuilders.html#diversifiedSampler-java.lang.String-[AggregationBuilders.diversifiedSampler()]
| {ref}/search-aggregations-bucket-filter-aggregation.html[Filter] | {agg-ref}/bucket/filter/FilterAggregationBuilder.html[FilterAggregationBuilder] | {agg-ref}/AggregationBuilders.html#filter-java.lang.String-org.elasticsearch.index.query.QueryBuilder-[AggregationBuilders.filter()]
| {ref}/search-aggregations-bucket-filters-aggregation.html[Filters] | {agg-ref}/bucket/filters/FiltersAggregationBuilder.html[FiltersAggregationBuilder] | {agg-ref}/AggregationBuilders.html#filters-java.lang.String-org.elasticsearch.index.query.QueryBuilder...-[AggregationBuilders.filters()]
| {ref}/search-aggregations-bucket-geodistance-aggregation.html[Geo Distance] | {agg-ref}/bucket/range/GeoDistanceAggregationBuilder.html[GeoDistanceAggregationBuilder] | {agg-ref}/AggregationBuilders.html#geoDistance-java.lang.String-org.elasticsearch.common.geo.GeoPoint-[AggregationBuilders.geoDistance()]
| {ref}/search-aggregations-bucket-geohashgrid-aggregation.html[GeoHash Grid] | {agg-ref}/bucket/geogrid/GeoGridAggregationBuilder.html[GeoGridAggregationBuilder] | {agg-ref}/AggregationBuilders.html#geohashGrid-java.lang.String-[AggregationBuilders.geohashGrid()]
| {ref}/search-aggregations-bucket-global-aggregation.html[Global] | {agg-ref}/bucket/global/GlobalAggregationBuilder.html[GlobalAggregationBuilder] | {agg-ref}/AggregationBuilders.html#global-java.lang.String-[AggregationBuilders.global()]
| {ref}/search-aggregations-bucket-histogram-aggregation.html[Histogram] | {agg-ref}/bucket/histogram/HistogramAggregationBuilder.html[HistogramAggregationBuilder] | {agg-ref}/AggregationBuilders.html#histogram-java.lang.String-[AggregationBuilders.histogram()]
| {ref}/search-aggregations-bucket-iprange-aggregation.html[IP Range] | {agg-ref}/bucket/range/IpRangeAggregationBuilder.html[IpRangeAggregationBuilder] | {agg-ref}/AggregationBuilders.html#ipRange-java.lang.String-[AggregationBuilders.ipRange()]
| {ref}/search-aggregations-bucket-missing-aggregation.html[Missing] | {agg-ref}/bucket/missing/MissingAggregationBuilder.html[MissingAggregationBuilder] | {agg-ref}/AggregationBuilders.html#missing-java.lang.String-[AggregationBuilders.missing()]
| {ref}/search-aggregations-bucket-nested-aggregation.html[Nested] | {agg-ref}/bucket/nested/NestedAggregationBuilder.html[NestedAggregationBuilder] | {agg-ref}/AggregationBuilders.html#nested-java.lang.String-java.lang.String-[AggregationBuilders.nested()]
| {ref}/search-aggregations-bucket-range-aggregation.html[Range] | {agg-ref}/bucket/range/RangeAggregationBuilder.html[RangeAggregationBuilder] | {agg-ref}/AggregationBuilders.html#range-java.lang.String-[AggregationBuilders.range()]
| {ref}/search-aggregations-bucket-reverse-nested-aggregation.html[Reverse nested] | {agg-ref}/bucket/nested/ReverseNestedAggregationBuilder.html[ReverseNestedAggregationBuilder] | {agg-ref}/AggregationBuilders.html#reverseNested-java.lang.String-[AggregationBuilders.reverseNested()]
| {ref}/search-aggregations-bucket-sampler-aggregation.html[Sampler] | {agg-ref}/bucket/sampler/SamplerAggregationBuilder.html[SamplerAggregationBuilder] | {agg-ref}/AggregationBuilders.html#sampler-java.lang.String-[AggregationBuilders.sampler()]
| {ref}/search-aggregations-bucket-significantterms-aggregation.html[Significant Terms] | {agg-ref}/bucket/significant/SignificantTermsAggregationBuilder.html[SignificantTermsAggregationBuilder] | {agg-ref}/AggregationBuilders.html#significantTerms-java.lang.String-[AggregationBuilders.significantTerms()]
| {ref}/search-aggregations-bucket-significanttext-aggregation.html[Significant Text] | {agg-ref}/bucket/significant/SignificantTextAggregationBuilder.html[SignificantTextAggregationBuilder] | {agg-ref}/AggregationBuilders.html#significantText-java.lang.String-java.lang.String-[AggregationBuilders.significantText()]
| {ref}/search-aggregations-bucket-terms-aggregation.html[Terms] | {agg-ref}/bucket/terms/TermsAggregationBuilder.html[TermsAggregationBuilder] | {agg-ref}/AggregationBuilders.html#terms-java.lang.String-[AggregationBuilders.terms()]
|======
==== Pipeline Aggregations
[options="header"]
|======
| Pipeline on | PipelineAggregationBuilder Class | Method in PipelineAggregatorBuilders
| {ref}/search-aggregations-pipeline-avg-bucket-aggregation.html[Avg Bucket] | {agg-ref}/pipeline/AvgBucketPipelineAggregationBuilder.html[AvgBucketPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#avgBucket-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.avgBucket()]
| {ref}/search-aggregations-pipeline-derivative-aggregation.html[Derivative] | {agg-ref}/pipeline/DerivativePipelineAggregationBuilder.html[DerivativePipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#derivative-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.derivative()]
| {ref}/search-aggregations-pipeline-inference-bucket-aggregation.html[Inference] | {javadoc-client}/analytics/InferencePipelineAggregationBuilder.html[InferencePipelineAggregationBuilder] | None
| {ref}/search-aggregations-pipeline-max-bucket-aggregation.html[Max Bucket] | {agg-ref}/pipeline/MaxBucketPipelineAggregationBuilder.html[MaxBucketPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#maxBucket-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.maxBucket()]
| {ref}/search-aggregations-pipeline-min-bucket-aggregation.html[Min Bucket] | {agg-ref}/pipeline/MinBucketPipelineAggregationBuilder.html[MinBucketPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#minBucket-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.minBucket()]
| {ref}/search-aggregations-pipeline-sum-bucket-aggregation.html[Sum Bucket] | {agg-ref}/pipeline/SumBucketPipelineAggregationBuilder.html[SumBucketPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#sumBucket-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.sumBucket()]
| {ref}/search-aggregations-pipeline-stats-bucket-aggregation.html[Stats Bucket] | {agg-ref}/pipeline/StatsBucketPipelineAggregationBuilder.html[StatsBucketPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#statsBucket-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.statsBucket()]
| {ref}/search-aggregations-pipeline-extended-stats-bucket-aggregation.html[Extended Stats Bucket] | {agg-ref}/pipeline/ExtendedStatsBucketPipelineAggregationBuilder.html[ExtendedStatsBucketPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#extendedStatsBucket-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.extendedStatsBucket()]
| {ref}/search-aggregations-pipeline-percentiles-bucket-aggregation.html[Percentiles Bucket] | {agg-ref}/pipeline/PercentilesBucketPipelineAggregationBuilder.html[PercentilesBucketPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#percentilesBucket-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.percentilesBucket()]
| {ref}/search-aggregations-pipeline-movfn-aggregation.html[Moving Function] | {agg-ref}/pipeline/MovFnPipelineAggregationBuilder.html[MovFnPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#movingFunction-java.lang.String-org.elasticsearch.script.Script-java.lang.String-int-[PipelineAggregatorBuilders.movingFunction()]
| {ref}/search-aggregations-pipeline-cumulative-sum-aggregation.html[Cumulative Sum] | {agg-ref}/pipeline/CumulativeSumPipelineAggregationBuilder.html[CumulativeSumPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#cumulativeSum-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.cumulativeSum()]
| {ref}/search-aggregations-pipeline-bucket-script-aggregation.html[Bucket Script] | {agg-ref}/pipeline/BucketScriptPipelineAggregationBuilder.html[BucketScriptPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#bucketScript-java.lang.String-java.util.Map-org.elasticsearch.script.Script-[PipelineAggregatorBuilders.bucketScript()]
| {ref}/search-aggregations-pipeline-bucket-selector-aggregation.html[Bucket Selector] | {agg-ref}/pipeline/BucketSelectorPipelineAggregationBuilder.html[BucketSelectorPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#bucketSelector-java.lang.String-java.util.Map-org.elasticsearch.script.Script-[PipelineAggregatorBuilders.bucketSelector()]
| {ref}/search-aggregations-pipeline-serialdiff-aggregation.html[Serial Differencing] | {agg-ref}/pipeline/SerialDiffPipelineAggregationBuilder.html[SerialDiffPipelineAggregationBuilder] | {agg-ref}/PipelineAggregatorBuilders.html#diff-java.lang.String-java.lang.String-[PipelineAggregatorBuilders.diff()]
|======
==== Matrix Aggregations
[options="header"]
|======
| Aggregation | AggregationBuilder Class | Method in MatrixStatsAggregationBuilders
| {ref}/search-aggregations-matrix-stats-aggregation.html[Matrix Stats] | {matrixstats-ref}/matrix/stats/MatrixStatsAggregationBuilder.html[MatrixStatsAggregationBuilder] | {matrixstats-ref}/MatrixStatsAggregationBuilders.html#matrixStats-java.lang.String-[MatrixStatsAggregationBuilders.matrixStats()]
|======

View file

@ -1,68 +0,0 @@
--
:api: asyncsearch-delete
:request: DeleteAsyncSearchRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Delete Async Search API
[id="{upid}-{api}-request"]
==== Request
A +{request}+ allows deleting a running asynchronous search task using
its id. Required arguments are the `id` of a running search:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-sync"]
==== Synchronous Execution
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute]
--------------------------------------------------
<1> Execute the request and get back the response as an +{response}+ object.
[id="{upid}-{api}-async"]
==== Asynchronous Execution
The asynchronous execution of a +{request}+ allows to use an
`ActionListener` to be called back when the submit request returns:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute-async]
--------------------------------------------------
<1> The +{request}+ to execute and the `ActionListener` to use when
the execution completes
The asynchronous method does not block and returns immediately. Once it is
completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed.
A typical listener for +{response}+ looks like:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-listener]
--------------------------------------------------
<1> Called when the execution is successfully completed. The response is
provided as an argument
<2> Called in case of failure. The raised exception is provided as an argument
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates the acknowledgement of the request:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> `isAcknowledged` was the deletion request acknowledged or not.

View file

@ -1,87 +0,0 @@
--
:api: asyncsearch-get
:request: GetAsyncSearchRequest
:response: AsyncSearchResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get Async Search API
[id="{upid}-{api}-request"]
==== Request
A +{request}+ allows to get a running asynchronous search task by
its id. Required arguments are the `id` of a running async search:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-arguments]
--------------------------------------------------
<1> The minimum time that the request should wait before
returning a partial result (defaults to no wait).
<2> The expiration time of the request (defaults to none).
[id="{upid}-{api}-sync"]
==== Synchronous Execution
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute]
--------------------------------------------------
<1> Execute the request and get back the response as an +{response}+ object.
[id="{upid}-{api}-async"]
==== Asynchronous Execution
The asynchronous execution of a +{request}+ allows to use an
`ActionListener` to be called back when the submit request returns:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute-async]
--------------------------------------------------
<1> The +{request}+ to execute and the `ActionListener` to use when
the execution completes
The asynchronous method does not block and returns immediately. Once it is
completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed.
A typical listener for +{response}+ looks like:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-listener]
--------------------------------------------------
<1> Called when the execution is successfully completed. The response is
provided as an argument
<2> Called in case of failure. The raised exception is provided as an argument
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ allows to retrieve information about the executed
operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The `SearchResponse`, or `null` if not available yet
<2> The id of the async search request, `null` if the response isn't stored
<3> `true` when the response contains partial results
<4> `true` when the search is still running
<5> The time the response was created (millis since epoch)
<6> The time the response expires (millis since epoch)
<7> Get failure reasons or `null` for no failures

View file

@ -1,94 +0,0 @@
--
:api: asyncsearch-submit
:request: SubmitAsyncSearchRequest
:response: AsyncSearchResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Submit Async Search API
[id="{upid}-{api}-request"]
==== Request
A +{request}+ allows to submit an asynchronous search task to
the cluster. Required arguments are the `SearchSourceBuilder` defining
the search and the target indices:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The definition of the search to run
<2> The target indices for the search
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-arguments]
--------------------------------------------------
<1> The minimum time that the request should wait before
returning a partial result (defaults to 1 second).
<2> The expiration time of the request (defaults to 5 days).
<3> Controls whether the results should be stored if the request
completed within the provided `wait_for_completion` time (default: false)
[id="{upid}-{api}-sync"]
==== Synchronous Execution
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute]
--------------------------------------------------
<1> Execute the request and get back the response as an +{response}+ object.
[id="{upid}-{api}-async"]
==== Asynchronous Execution
The asynchronous execution of a +{request}+ allows to use an
`ActionListener` to be called back when the submit request returns. Note
that this is does not concern the execution of the submitted search request,
which always executes asynchronously. The listener, however, waits for the
submit request itself to come back:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute-async]
--------------------------------------------------
<1> The +{request}+ to execute and the `ActionListener` to use when
the execution completes
The asynchronous method does not block and returns immediately. Once it is
completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed.
A typical listener for +{response}+ looks like:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-listener]
--------------------------------------------------
<1> Called when the execution is successfully completed. The response is
provided as an argument
<2> Called in case of failure. The raised exception is provided as an argument
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ allows to retrieve information about the executed
operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The `SearchResponse`, or `null` if not available yet
<2> The id of the async search request, `null` if the response isn't stored
<3> `true` when the response contains partial results
<4> `true` when the search is still running
<5> The time the response was created (millis since epoch)
<6> The time the response expires (millis since epoch)
<7> Get failure reasons or `null` for no failures

View file

@ -1,32 +0,0 @@
--
:api: ccr-delete-auto-follow-pattern
:request: DeleteAutoFollowPatternRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Delete Auto Follow Pattern API
[id="{upid}-{api}-request"]
==== Request
The Delete Auto Follow Pattern API allows you to delete an auto follow pattern.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the auto follow pattern to delete.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the delete auto follow pattern request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the delete auto follow pattern request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,45 +0,0 @@
--
:api: ccr-forget-follower
:request: ForgetFollowerRequest
:response: BroadcastResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Forget Follower API
[id="{upid}-{api}-request"]
==== Request
The Forget Follower API allows you to manually remove the follower retention
leases from the leader. Note that these retention leases are automatically
managed by the following index. This API exists only for cases when invoking
the unfollow API on the follower index is unable to remove the follower
retention leases.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the cluster containing the follower index.
<2> The name of the follower index.
<3> The UUID of the follower index (can be obtained from index stats).
<4> The alias of the remote cluster containing the leader index.
<5> The name of the leader index.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the response was successful.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The high-level shards summary.
<2> The total number of shards the request was executed on.
<3> The total number of shards the request was successful on.
<4> The total number of shards the request was skipped on (should always be zero).
<5> The total number of shards the request failed on.
<6> The shard-level failures.
include::../execution.asciidoc[]

View file

@ -1,35 +0,0 @@
--
:api: ccr-get-auto-follow-pattern
:request: GetAutoFollowPatternRequest
:response: GetAutoFollowPatternResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get Auto Follow Pattern API
[id="{upid}-{api}-request"]
==== Request
The Get Auto Follow Pattern API allows you to get a specified auto follow pattern
or all auto follow patterns.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the auto follow pattern to get.
Use the default constructor to get all auto follow patterns.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ includes the requested auto follow pattern or
all auto follow patterns if default constructor or request class was used.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Get the requested pattern from the list of returned patterns
include::../execution.asciidoc[]

View file

@ -1,35 +0,0 @@
--
:api: ccr-get-follow-info
:request: FollowInfoRequest
:response: FollowInfoResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get Follow Info API
[id="{upid}-{api}-request"]
==== Request
The Get Follow Info API allows you to get follow information (parameters and status) for specific follower indices.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The follower index to get follow information for.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ includes follow information for the specified follower indices
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The follow information for specified follower indices.
include::../execution.asciidoc[]

View file

@ -1,35 +0,0 @@
--
:api: ccr-get-follow-stats
:request: FollowStatsRequest
:response: FollowStatsResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get Follow Stats API
[id="{upid}-{api}-request"]
==== Request
The Get Follow Stats API allows you to get follow statistics for specific follower indices.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The follower index to get follow statistics for.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ includes follow statistics for the specified follower indices
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The follow stats for specified follower indices.
include::../execution.asciidoc[]

View file

@ -1,37 +0,0 @@
--
:api: ccr-get-stats
:request: CcrStatsRequest
:response: CcrStatsResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get CCR Stats API
[id="{upid}-{api}-request"]
==== Request
The Get CCR Stats API allows you to get statistics about index following and auto following.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The request accepts no parameters.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ always includes index follow statistics of all follow indices and
auto follow statistics.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The follow stats of active follower indices.
<2> The auto follow stats of the cluster that has been queried.
include::../execution.asciidoc[]

View file

@ -1,32 +0,0 @@
--
:api: ccr-pause-auto-follow-pattern
:request: PauseAutoFollowPatternRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Pause Auto Follow Pattern API
[id="{upid}-{api}-request"]
==== Request
The Pause Auto Follow Pattern API allows you to pause an existing auto follow pattern.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the auto follow pattern.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the pause auto follow pattern request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the pause auto follow pattern request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,35 +0,0 @@
--
:api: ccr-pause-follow
:request: PauseFollowRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Pause Follow API
[id="{upid}-{api}-request"]
==== Request
The Pause Follow API allows you to pause following by follow index name.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of follow index.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the pause follow request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the pause follow was acknowledge.
include::../execution.asciidoc[]

View file

@ -1,39 +0,0 @@
--
:api: ccr-put-auto-follow-pattern
:request: PutAutoFollowPatternRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Put Auto Follow Pattern API
[id="{upid}-{api}-request"]
==== Request
The Put Auto Follow Pattern API allows you to store auto follow patterns in order
to automatically follow leader indices in a remote clusters matching certain
index name patterns.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the auto follow pattern.
<2> The name of the remote cluster.
<3> The leader index patterns.
<4> The leader index exclusion patterns.
<5> The pattern used to create the follower index.
<6> The settings overrides for the follower index.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the put auto follow pattern request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the put auto follow pattern request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,39 +0,0 @@
--
:api: ccr-put-follow
:request: PutFollowRequest
:response: PutFollowResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Create follower API
[id="{upid}-{api}-request"]
==== Request
Creates a follower index and makes that index follow a leader index.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the remote cluster alias.
<2> The name of the leader in the remote cluster.
<3> The name of the follower index to create.
<4> The number of shard copies that must be active before the call returns.
<5> The settings overrides for the follower index.
[id="{upid}-{api}-response"]
==== Response
The +{response}+ indicates if the request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether the follower index was created.
<2> Whether the follower shards are started.
<3> Whether the follower index started following the leader index.
include::../execution.asciidoc[]

View file

@ -1,33 +0,0 @@
--
:api: ccr-resume-auto-follow-pattern
:request: ResumeAutoFollowPatternRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Resume Auto Follow Pattern API
[id="{upid}-{api}-request"]
==== Request
The Resume Auto Follow Pattern API allows you to resume the activity
for a pause auto follow pattern.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the auto follow pattern.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the resume auto follow pattern request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the resume auto follow pattern request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,35 +0,0 @@
--
:api: ccr-resume-follow
:request: ResumeFollowRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Resume Follow API
[id="{upid}-{api}-request"]
==== Request
The Resume Follow API allows you to resume following a follower index that has been paused.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of follower index.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the resume follow request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the resume follow was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,36 +0,0 @@
--
:api: ccr-unfollow
:request: UnfollowRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Unfollow API
[id="{upid}-{api}-request"]
==== Request
The Unfollow API allows you to unfollow a follower index and make it a regular index.
Note that the follower index needs to be paused and the follower index needs to be closed.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of follow index to unfollow.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the unfollow request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the unfollow was acknowledge.
include::../execution.asciidoc[]

View file

@ -1,41 +0,0 @@
--
:api: delete-component-template
:request: DeleteComponentTemplateRequest
:response: AcknowledgedResponse
--
[id="{upid}-{api}"]
=== Delete Component Template API
[id="{upid}-{api}-request"]
==== Request
The Delete Component Template API allows you to delete a component template.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the component template to delete.
=== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the delete component template request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the delete component template request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,42 +0,0 @@
--
:api: get-component-templates
:request: GetComponentTemplatesRequest
:response: GetComponentTemplatesResponse
--
[id="{upid}-{api}"]
=== Get Component Templates API
The Get Component Templates API allows to retrieve information about one or more component templates.
[id="{upid}-{api}-request"]
==== Get Component Templates Request
A +{request}+ specifies one component template name to retrieve.
To return all component templates omit the name altogether.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> A single component template name
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Component Templates Response
The returned +{response}+ consists a map of component template names and their corresponding definition.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> A map of matching component template names and the corresponding definitions

View file

@ -1,63 +0,0 @@
--
:api: get-settings
:request: ClusterGetSettingsRequest
:response: ClusterGetSettingsResponse
--
[id="{upid}-{api}"]
=== Cluster Get Settings API
The Cluster Get Settings API allows to get the cluster wide settings.
[id="{upid}-{api}-request"]
==== Cluster Get Settings Request
A +{request}+:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-includeDefaults]
--------------------------------------------------
<1> By default only those settings that were explicitly set are returned. Setting this to true also returns
the default settings.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-local]
--------------------------------------------------
<1> By default the request goes to the master of the cluster to get the latest results. If local is specified it gets
the results from whichever node the request goes to.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Cluster Get Settings Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Get the persistent settings.
<2> Get the transient settings.
<3> Get the default settings (returns empty settings if `includeDefaults` was not set to `true`).
<4> Get the value as a `String` for a particular setting. The order of searching is first in `persistentSettings` then in
`transientSettings` and finally, if not found in either, in `defaultSettings`.

View file

@ -1,177 +0,0 @@
--
:api: health
:request: ClusterHealthRequest
:response: ClusterHealthResponse
--
[id="{upid}-{api}"]
=== Cluster Health API
The Cluster Health API allows getting cluster health.
[id="{upid}-{api}-request"]
==== Cluster Health Request
A +{request}+:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
There are no required parameters. By default, the client will check all indices and will not wait
for any events.
==== Indices
Indices which should be checked can be passed in the constructor:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indices-ctr]
--------------------------------------------------
Or using the corresponding setter method:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indices-setter]
--------------------------------------------------
==== Other parameters
Other parameters can be passed only through setter methods:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout for the request as a `TimeValue`. Defaults to 30 seconds
<2> As a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-master-timeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`. Defaults to the same as `timeout`
<2> As a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-wait-status]
--------------------------------------------------
<1> The status to wait (e.g. `green`, `yellow`, or `red`). Accepts a `ClusterHealthStatus` value.
<2> Using predefined method
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-wait-events]
--------------------------------------------------
<1> The priority of the events to wait for. Accepts a `Priority` value.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-level]
--------------------------------------------------
<1> The level of detail of the returned health information. Accepts a +{request}.Level+ value.
Default value is `cluster`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-wait-relocation]
--------------------------------------------------
<1> Wait for 0 relocating shards. Defaults to `false`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-wait-initializing]
--------------------------------------------------
<1> Wait for 0 initializing shards. Defaults to `false`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-wait-nodes]
--------------------------------------------------
<1> Wait for `N` nodes in the cluster. Defaults to `0`
<2> Using `>=N`, `<=N`, `>N` and `<N` notation
<3> Using `ge(N)`, `le(N)`, `gt(N)`, `lt(N)` notation
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-wait-active]
--------------------------------------------------
<1> Wait for all shards to be active in the cluster
<2> Wait for `N` shards to be active in the cluster
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-local]
--------------------------------------------------
<1> Non-master node can be used for this request. Defaults to `false`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Cluster Health Response
The returned +{response}+ contains the next information about the
cluster:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-general]
--------------------------------------------------
<1> Name of the cluster
<2> Cluster status (`green`, `yellow` or `red`)
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-request-status]
--------------------------------------------------
<1> Whether request was timed out while processing
<2> Status of the request (`OK` or `REQUEST_TIMEOUT`). Other errors will be thrown as exceptions
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-nodes]
--------------------------------------------------
<1> Number of nodes in the cluster
<2> Number of data nodes in the cluster
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-shards]
--------------------------------------------------
<1> Number of active shards
<2> Number of primary active shards
<3> Number of relocating shards
<4> Number of initializing shards
<5> Number of unassigned shards
<6> Number of unassigned shards that are currently being delayed
<7> Percent of active shards
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-task]
--------------------------------------------------
<1> Maximum wait time of all tasks in the queue
<2> Number of currently pending tasks
<3> Number of async fetches that are currently ongoing
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-indices]
--------------------------------------------------
<1> Detailed information about indices in the cluster
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-index]
--------------------------------------------------
<1> Detailed information about a specific index
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-shard-details]
--------------------------------------------------
<1> Detailed information about a specific shard

View file

@ -1,64 +0,0 @@
--
:api: put-component-template
:request: PutComponentTemplateRequest
:response: AcknowledgedResponse
--
[id="{upid}-{api}"]
=== Create or update component template API
Creates or updates a component template.
[id="{upid}-{api}-request"]
==== Request
A +{request}+ specifies the name of the component template and the template definition,
which can consist of the settings, mappings or aliases, together with a version (which
can be used to simply component template management by external systems) and a metadata
map consisting of user specific information.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the component template
<2> Template configuration containing the settings, mappings and aliases for this component template
===== Version
A component template can optionally specify a version number which can be used to simplify template
management by external systems.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-version]
--------------------------------------------------
<1> The version number of the template
=== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-create]
--------------------------------------------------
<1> To force to only create a new template; do not overwrite the existing template
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request

View file

@ -1,93 +0,0 @@
--
:api: put-settings
:request: ClusterUpdateSettingsRequest
:response: ClusterUpdateSettingsResponse
--
[id="{upid}-{api}"]
=== Cluster Update Settings API
The Cluster Update Settings API allows to update cluster wide settings.
[id="{upid}-{api}-request"]
==== Cluster Update Settings Request
A +{request}+:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
==== Cluster Settings
At least one setting to be updated must be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-cluster-settings]
--------------------------------------------------
<1> Sets the transient settings to be applied
<2> Sets the persistent setting to be applied
==== Providing the Settings
The settings to be applied can be provided in different ways:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-create-settings]
--------------------------------------------------
<1> Creates a transient setting as `Settings`
<2> Creates a persistent setting as `Settings`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-settings-builder]
--------------------------------------------------
<1> Settings provided as `Settings.Builder`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-settings-source]
--------------------------------------------------
<1> Settings provided as `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-settings-map]
--------------------------------------------------
<1> Settings provided as a `Map`
==== Optional Arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the settings were applied
as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the settings were applied
as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Cluster Update Settings Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates which transient settings have been applied
<3> Indicates which persistent settings have been applied

View file

@ -1,32 +0,0 @@
--
:api: remote-info
:request: RemoteInfoRequest
:response: RemoteInfoResponse
--
[id="{upid}-{api}"]
=== Remote Cluster Info API
The Remote cluster info API allows to get all of the configured remote cluster information.
[id="{upid}-{api}-request"]
==== Remote Cluster Info Request
A +{request}+:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
There are no required parameters.
==== Remote Cluster Info Response
The returned +{response}+ allows to retrieve remote cluster information.
It returns connection and endpoint information keyed by the configured remote cluster alias.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------

View file

@ -1,217 +0,0 @@
--
:api: bulk
:request: BulkRequest
:response: BulkResponse
--
[id="{upid}-{api}"]
=== Bulk API
NOTE: The Java High Level REST Client provides the
<<{upid}-{api}-processor>> to assist with bulk requests.
[id="{upid}-{api}-request"]
==== Bulk Request
A +{request}+ can be used to execute multiple index, update and/or delete
operations using a single request.
It requires at least one operation to be added to the Bulk request:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Creates the +{request}+
<2> Adds a first `IndexRequest` to the Bulk request. See <<{upid}-index>> for
more information on how to build `IndexRequest`.
<3> Adds a second `IndexRequest`
<4> Adds a third `IndexRequest`
WARNING: The Bulk API supports only documents encoded in JSON or SMILE.
Providing documents in any other format will result in an error.
And different operation types can be added to the same +{request}+:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-with-mixed-operations]
--------------------------------------------------
<1> Adds a `DeleteRequest` to the +{request}+. See <<{upid}-delete>>
for more information on how to build `DeleteRequest`.
<2> Adds an `UpdateRequest` to the +{request}+. See <<{upid}-update>>
for more information on how to build `UpdateRequest`.
<3> Adds an `IndexRequest` using the SMILE format
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the bulk request to be performed as a `TimeValue`
<2> Timeout to wait for the bulk request to be performed as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-refresh]
--------------------------------------------------
<1> Refresh policy as a `WriteRequest.RefreshPolicy` instance
<2> Refresh policy as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-active-shards]
--------------------------------------------------
<1> Sets the number of shard copies that must be active before proceeding with
the index/update/delete operations.
<2> Number of shard copies provided as a `ActiveShardCount`: can be
`ActiveShardCount.ALL`, `ActiveShardCount.ONE` or
`ActiveShardCount.DEFAULT` (default)
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-pipeline]
--------------------------------------------------
<1> Global pipelineId used on all sub requests, unless overridden on a sub request
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-routing]
--------------------------------------------------
<1> Global routingId used on all sub requests, unless overridden on a sub request
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-index-type]
--------------------------------------------------
<1> A bulk request with a global index used on all sub requests, unless overridden on a sub request.
This parameter is @Nullable and can only be set during +{request}+ creation.
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Bulk Response
The returned +{response}+ contains information about the executed operations and
allows to iterate over each result as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Iterate over the results of all operations
<2> Retrieve the response of the operation (successful or not), can be
`IndexResponse`, `UpdateResponse` or `DeleteResponse` which can all be seen as
`DocWriteResponse` instances
<3> Handle the response of an index operation
<4> Handle the response of a update operation
<5> Handle the response of a delete operation
The Bulk response provides a method to quickly check if one or more operation
has failed:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-has-failures]
--------------------------------------------------
<1> This method returns `true` if at least one operation failed
In such situation it is necessary to iterate over all operation results in order
to check if the operation failed, and if so, retrieve the corresponding failure:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-errors]
--------------------------------------------------
<1> Indicate if a given operation failed
<2> Retrieve the failure of the failed operation
[id="{upid}-{api}-processor"]
==== Bulk Processor
The `BulkProcessor` simplifies the usage of the Bulk API by providing
a utility class that allows index/update/delete operations to be
transparently executed as they are added to the processor.
In order to execute the requests, the `BulkProcessor` requires the following
components:
`RestHighLevelClient`:: This client is used to execute the +{request}+
and to retrieve the `BulkResponse`
`BulkProcessor.Listener`:: This listener is called before and after
every +{request}+ execution or when a +{request}+ failed
Then the `BulkProcessor.builder` method can be used to build a new
`BulkProcessor`:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-processor-init]
--------------------------------------------------
<1> Create the `BulkProcessor.Listener`
<2> This method is called before each execution of a +{request}+
<3> This method is called after each execution of a +{request}+
<4> This method is called when a +{request}+ failed
<5> Create the `BulkProcessor` by calling the `build()` method from
the `BulkProcessor.Builder`. The `RestHighLevelClient.bulkAsync()`
method will be used to execute the +{request}+ under the hood.
The `BulkProcessor.Builder` provides methods to configure how the
`BulkProcessor` should handle requests execution:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-processor-options]
--------------------------------------------------
<1> Set when to flush a new bulk request based on the number of
actions currently added (defaults to 1000, use -1 to disable it)
<2> Set when to flush a new bulk request based on the size of
actions currently added (defaults to 5Mb, use -1 to disable it)
<3> Set the number of concurrent requests allowed to be executed
(default to 1, use 0 to only allow the execution of a single request)
<4> Set a flush interval flushing any +{request}+ pending if the
interval passes (defaults to not set)
<5> Set a constant back off policy that initially waits for 1 second
and retries up to 3 times. See `BackoffPolicy.noBackoff()`,
`BackoffPolicy.constantBackoff()` and `BackoffPolicy.exponentialBackoff()`
for more options.
Once the `BulkProcessor` is created requests can be added to it:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-processor-add]
--------------------------------------------------
The requests will be executed by the `BulkProcessor`, which takes care of
calling the `BulkProcessor.Listener` for every bulk request.
The listener provides methods to access to the +{request}+ and the +{response}+:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-processor-listener]
--------------------------------------------------
<1> Called before each execution of a +{request}+, this method allows to know
the number of operations that are going to be executed within the +{request}+
<2> Called after each execution of a +{request}+, this method allows to know if
the +{response}+ contains errors
<3> Called if the +{request}+ failed, this method allows to know
the failure
Once all requests have been added to the `BulkProcessor`, its instance needs to
be closed using one of the two available closing methods.
The `awaitClose()` method can be used to wait until all requests have been
processed or the specified waiting time elapses:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-processor-await]
--------------------------------------------------
<1> The method returns `true` if all bulk requests completed and `false` if the
waiting time elapsed before all the bulk requests completed
The `close()` method can be used to immediately close the `BulkProcessor`:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-processor-close]
--------------------------------------------------
Both methods flush the requests added to the processor before closing the
processor and also forbid any new request to be added to it.

View file

@ -1,131 +0,0 @@
--
:api: delete-by-query
:request: DeleteByQueryRequest
:response: DeleteByQueryResponse
--
[id="{upid}-{api}"]
=== Delete By Query API
[id="{upid}-{api}-request"]
==== Delete By Query Request
A +{request}+ can be used to delete documents from an index. It requires an
existing index (or a set of indices) on which deletion is to be performed.
The simplest form of a +{request}+ looks like this and deletes all documents
in an index:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Creates the +{request}+ on a set of indices.
By default version conflicts abort the +{request}+ process but you can just
count them with this:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-conflicts]
--------------------------------------------------
<1> Set `proceed` on version conflict
You can limit the documents by adding a query.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-query]
--------------------------------------------------
<1> Only copy documents which have field `user` set to `kimchy`
Its also possible to limit the number of processed documents by setting `maxDocs`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-maxDocs]
--------------------------------------------------
<1> Only copy 10 documents
By default +{request}+ uses batches of 1000. You can change the batch size
with `setBatchSize`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-scrollSize]
--------------------------------------------------
<1> Use batches of 100 documents
+{request}+ can also be parallelized using `sliced-scroll` with `setSlices`:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-slices]
--------------------------------------------------
<1> set number of slices to use
+{request}+ uses the `scroll` parameter to control how long it keeps the
"search context" alive.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-scroll]
--------------------------------------------------
<1> set scroll time
If you provide routing then the routing is copied to the scroll query, limiting the process to the shards that match
that routing value.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-routing]
--------------------------------------------------
<1> set routing
==== Optional arguments
In addition to the options above the following arguments can optionally be also provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the delete by query request to be performed as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-refresh]
--------------------------------------------------
<1> Refresh index after calling delete by query
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Set indices options
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Delete By Query Response
The returned +{response}+ contains information about the executed operations and
allows to iterate over each result as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Get total time taken
<2> Check if the request timed out
<3> Get total number of docs processed
<4> Number of docs that were deleted
<5> Number of batches that were executed
<6> Number of skipped docs
<7> Number of version conflicts
<8> Number of times request had to retry bulk index operations
<9> Number of times request had to retry search operations
<10> The total time this request has throttled itself not including the current throttle time if it is currently sleeping
<11> Remaining delay of any current throttle sleep or 0 if not sleeping
<12> Failures during search phase
<13> Failures during bulk index operation

View file

@ -1,90 +0,0 @@
--
:api: delete
:request: DeleteRequest
:response: DeleteResponse
--
[id="{upid}-{api}"]
=== Delete API
[id="{upid}-{api}-request"]
==== Delete Request
A +{request}+ has two required arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Index
<2> Document id
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-routing]
--------------------------------------------------
<1> Routing value
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for primary shard to become available as a `TimeValue`
<2> Timeout to wait for primary shard to become available as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-refresh]
--------------------------------------------------
<1> Refresh policy as a `WriteRequest.RefreshPolicy` instance
<2> Refresh policy as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-version]
--------------------------------------------------
<1> Version
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-version-type]
--------------------------------------------------
<1> Version type
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Delete Response
The returned +{response}+ allows to retrieve information about the executed
operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Handle the situation where number of successful shards is less than
total shards
<2> Handle the potential failures
It is also possible to check whether the document was found or not:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-notfound]
--------------------------------------------------
<1> Do something if the document to be deleted was not found
If there is a version conflict, an `ElasticsearchException` will
be thrown:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-conflict]
--------------------------------------------------
<1> The raised exception indicates that a version conflict error was returned

View file

@ -1,37 +0,0 @@
--
:api: exists
:request: GetRequest
:response: boolean
--
[id="{upid}-{api}"]
=== Exists API
The exists API returns `true` if a document exists, and `false` otherwise.
[id="{upid}-{api}-request"]
==== Exists Request
It uses +{request}+ just like the <<java-rest-high-document-get>>.
All of its <<java-rest-high-document-get-request-optional-arguments, optional arguments>>
are supported. Since `exists()` only returns `true` or `false`, we recommend
turning off fetching `_source` and any stored fields so the request is
slightly lighter:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Index
<2> Document id
<3> Disable fetching `_source`.
<4> Disable fetching stored fields.
include::../execution.asciidoc[]
==== Source exists request
A variant of the exists request is `existsSource` method which has the additional check
that the document in question has stored the `source`. If the mapping for the index has opted
to remove support for storing JSON source in documents then this method will return false
for documents in this index.

View file

@ -1,72 +0,0 @@
--
:api: get-source
:request: GetSourceRequest
:response: GetSourceResponse
--
[id="{upid}-{api}"]
=== Get Source API
This API helps to get only the `_source` field of a document.
[id="{upid}-{api}-request"]
==== Get Source Request
A +{request}+ requires the following arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Index
<2> Document id
[id="{upid}-{api}-request-optional"]
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-optional]
--------------------------------------------------
<1> `FetchSourceContext` 's first argument `fetchSource` must be `true`, otherwise
`ElasticsearchException` get thrown
<2> Arguments of the context `excludes` and `includes` are optional
(see examples in Get API documentation)
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-routing]
--------------------------------------------------
<1> Routing value
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-preference]
--------------------------------------------------
<1> Preference value
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-realtime]
--------------------------------------------------
<1> Set realtime flag to `false` (`true` by default)
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-refresh]
--------------------------------------------------
<1> Perform a refresh before retrieving the document (`false` by default)
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Source Response
The returned +{response}+ contains the field `source` that represents the
source of a document as a map.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------

View file

@ -1,126 +0,0 @@
--
:api: get
:request: GetRequest
:response: GetResponse
--
[id="{upid}-{api}"]
=== Get API
[id="{upid}-{api}-request"]
==== Get Request
A +{request}+ requires the following arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Index
<2> Document id
[id="{upid}-{api}-request-optional-arguments"]
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-no-source]
--------------------------------------------------
<1> Disable source retrieval, enabled by default
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-source-include]
--------------------------------------------------
<1> Configure source inclusion for specific fields
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-source-exclude]
--------------------------------------------------
<1> Configure source exclusion for specific fields
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-stored]
--------------------------------------------------
<1> Configure retrieval for specific stored fields (requires fields to be
stored separately in the mappings)
<2> Retrieve the `message` stored field (requires the field to be stored
separately in the mappings)
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-routing]
--------------------------------------------------
<1> Routing value
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-preference]
--------------------------------------------------
<1> Preference value
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-realtime]
--------------------------------------------------
<1> Set realtime flag to `false` (`true` by default)
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-refresh]
--------------------------------------------------
<1> Perform a refresh before retrieving the document (`false` by default)
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-version]
--------------------------------------------------
<1> Version
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-version-type]
--------------------------------------------------
<1> Version type
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Response
The returned +{response}+ allows to retrieve the requested document along with
its metadata and eventually stored fields.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Retrieve the document as a `String`
<2> Retrieve the document as a `Map<String, Object>`
<3> Retrieve the document as a `byte[]`
<4> Handle the scenario where the document was not found. Note that although
the returned response has `404` status code, a valid +{response}+ is
returned rather than an exception thrown. Such response does not hold any
source document and its `isExists` method returns `false`.
When a get request is performed against an index that does not exist, the
response has `404` status code, an `ElasticsearchException` gets thrown
which needs to be handled as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-indexnotfound]
--------------------------------------------------
<1> Handle the exception thrown because the index does not exist
In case a specific document version has been requested, and the existing
document has a different version number, a version conflict is raised:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-conflict]
--------------------------------------------------
<1> The raised exception indicates that a version conflict error was returned

View file

@ -1,132 +0,0 @@
--
:api: index
:request: IndexRequest
:response: IndexResponse
--
[id="{upid}-{api}"]
=== Index API
[id="{upid}-{api}-request"]
==== Index Request
An +{request}+ requires the following arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-string]
--------------------------------------------------
<1> Index
<2> Document id for the request
<3> Document source provided as a `String`
==== Providing the document source
The document source can be provided in different ways in addition to the
`String` example shown above:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-map]
--------------------------------------------------
<1> Document source provided as a `Map` which gets automatically converted
to JSON format
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-xcontent]
--------------------------------------------------
<1> Document source provided as an `XContentBuilder` object, the Elasticsearch
built-in helpers to generate JSON content
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-shortcut]
--------------------------------------------------
<1> Document source provided as `Object` key-pairs, which gets converted to
JSON format
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-routing]
--------------------------------------------------
<1> Routing value
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for primary shard to become available as a `TimeValue`
<2> Timeout to wait for primary shard to become available as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-refresh]
--------------------------------------------------
<1> Refresh policy as a `WriteRequest.RefreshPolicy` instance
<2> Refresh policy as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-version]
--------------------------------------------------
<1> Version
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-version-type]
--------------------------------------------------
<1> Version type
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-op-type]
--------------------------------------------------
<1> Operation type provided as an `DocWriteRequest.OpType` value
<2> Operation type provided as a `String`: can be `create` or `index` (default)
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-pipeline]
--------------------------------------------------
<1> The name of the ingest pipeline to be executed before indexing the document
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Index Response
The returned +{response}+ allows to retrieve information about the executed
operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Handle (if needed) the case where the document was created for the first
time
<2> Handle (if needed) the case where the document was rewritten as it was
already existing
<3> Handle the situation where number of successful shards is less than
total shards
<4> Handle the potential failures
If there is a version conflict, an `ElasticsearchException` will
be thrown:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-conflict]
--------------------------------------------------
<1> The raised exception indicates that a version conflict error was returned
Same will happen in case `opType` was set to `create` and a document with
same index and id already existed:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-optype]
--------------------------------------------------
<1> The raised exception indicates that a version conflict error was returned

View file

@ -1,134 +0,0 @@
--
:api: multi-get
:request: MultiGetRequest
:response: MultiGetResponse
--
[id="{upid}-{api}"]
=== Multi-Get API
The `multiGet` API executes multiple <<java-rest-high-document-get,`get`>>
requests in a single http request in parallel.
[id="{upid}-{api}-request"]
==== Multi-Get Request
A +{request}+ is built empty and you add `MultiGetRequest.Item`s to configure
what to fetch:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Index
<2> Document id
<3> Add another item to fetch
==== Optional arguments
`multiGet` supports the same optional arguments that the
<<java-rest-high-document-get-request-optional-arguments,`get` API>> supports.
You can set most of these on the `Item`:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-no-source]
--------------------------------------------------
<1> Disable source retrieval, enabled by default
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-source-include]
--------------------------------------------------
<1> Configure source inclusion for specific fields
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-source-exclude]
--------------------------------------------------
<1> Configure source exclusion for specific fields
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-stored]
--------------------------------------------------
<1> Configure retrieval for specific stored fields (requires fields to be
stored separately in the mappings)
<2> Retrieve the `foo` stored field (requires the field to be stored
separately in the mappings)
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-item-extras]
--------------------------------------------------
<1> Routing value
<2> Version
<3> Version type
{ref}/search-search.html#search-preference[`preference`],
{ref}/docs-get.html#realtime[`realtime`]
and
{ref}/docs-get.html#get-refresh[`refresh`] can be set on the main request but
not on any items:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-top-level-extras]
--------------------------------------------------
<1> Preference value
<2> Set realtime flag to `false` (`true` by default)
<3> Perform a refresh before retrieving the document (`false` by default)
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Multi Get Response
The returned +{response}+ contains a list of `MultiGetItemResponse`s in
`getResponses` in the same order that they were requested.
`MultiGetItemResponse` contains *either* a
<<java-rest-high-document-get-response, `GetResponse`>> if the get succeeded
or a `MultiGetResponse.Failure` if it failed. A success looks just like a
normal `GetResponse`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> `getFailure` returns null because there isn't a failure.
<2> `getResponse` returns the `GetResponse`.
<3> Retrieve the document as a `String`
<4> Retrieve the document as a `Map<String, Object>`
<5> Retrieve the document as a `byte[]`
<6> Handle the scenario where the document was not found. Note that although
the returned response has `404` status code, a valid `GetResponse` is
returned rather than an exception thrown. Such response does not hold any
source document and its `isExists` method returns `false`.
When one of the subrequests as performed against an index that does not exist
`getFailure` will contain an exception:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-indexnotfound]
--------------------------------------------------
<1> `getResponse` is null.
<2> `getFailure` isn't and contains an `Exception`.
<3> That `Exception` is actually an `ElasticsearchException`
<4> and it has a status of `NOT_FOUND`. It'd have been an HTTP 404 if this
wasn't a multi get.
<5> `getMessage` explains the actual cause, `no such index`.
In case a specific document version has been requested, and the existing
document has a different version number, a version conflict is raised:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-conflict]
--------------------------------------------------
<1> `getResponse` is null.
<2> `getFailure` isn't and contains an `Exception`.
<3> That `Exception` is actually an `ElasticsearchException`
<4> and it has a status of `CONFLICT`. It'd have been an HTTP 409 if this
wasn't a multi get.
<5> `getMessage` explains the actual cause, `

View file

@ -1,59 +0,0 @@
--
:api: multi-term-vectors
:request: MultiTermVectorsRequest
:response: MultiTermVectorsResponse
:tvrequest: TermVectorsRequest
--
[id="{upid}-{api}"]
=== Multi Term Vectors API
Multi Term Vectors API allows to get multiple term vectors at once.
[id="{upid}-{api}-request"]
==== Multi Term Vectors Request
There are two ways to create a +{request}+.
The first way is to create an empty +{request}+, and then add individual
<<java-rest-high-document-term-vectors, term vectors requests>> to it.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Create an empty +{request}+.
<2> Add the first +{tvrequest}+ to the +{request}+.
<3> Add the second +{tvrequest}+ for an artificial doc to the +{request}+.
The second way can be used when all term vectors requests share the same
arguments, such as index and other settings. In this case, a template
+{tvrequest}+ can be created with all necessary settings set, and
this template request can be passed to +{request}+ along with all
documents' ids for which to execute these requests.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-template]
--------------------------------------------------
<1> Create a template +{tvrequest}+.
<2> Pass documents' ids and the template to the +{request}+.
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Multi Term Vectors Response
+{response}+ allows to get the list of term vectors responses,
each of which can be inspected as described in
<<java-rest-high-document-term-vectors>>.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Get a list of `TermVectorsResponse`

View file

@ -1,186 +0,0 @@
--
:api: reindex
:request: ReindexRequest
:response: BulkByScrollResponse
--
[id="{upid}-{api}"]
=== Reindex API
[id="{upid}-{api}-request"]
==== Reindex Request
A +{request}+ can be used to copy documents from one or more indexes into a
destination index.
It requires an existing source index and a target index which may or may not exist pre-request. Reindex does not attempt
to set up the destination index. It does not copy the settings of the source index. You should set up the destination
index prior to running a _reindex action, including setting up mappings, shard counts, replicas, etc.
The simplest form of a +{request}+ looks like this:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Creates the +{request}+
<2> Adds a list of sources to copy from
<3> Adds the destination index
The `dest` element can be configured like the index API to control optimistic concurrency control. Just leaving out
`versionType` (as above) or setting it to internal will cause Elasticsearch to blindly dump documents into the target.
Setting `versionType` to external will cause Elasticsearch to preserve the version from the source, create any documents
that are missing, and update any documents that have an older version in the destination index than they do in the
source index.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-versionType]
--------------------------------------------------
<1> Set the versionType to `EXTERNAL`
Setting `opType` to `create` will cause `_reindex` to only create missing documents in the target index. All existing
documents will cause a version conflict. The default `opType` is `index`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-opType]
--------------------------------------------------
<1> Set the opType to `create`
By default version conflicts abort the `_reindex` process but you can just count
them instead with:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-conflicts]
--------------------------------------------------
<1> Set `proceed` on version conflict
You can limit the documents by adding a query.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-query]
--------------------------------------------------
<1> Only copy documents which have field `user` set to `kimchy`
Its also possible to limit the number of processed documents by setting `maxDocs`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-maxDocs]
--------------------------------------------------
<1> Only copy 10 documents
By default `_reindex` uses batches of 1000. You can change the batch size with `sourceBatchSize`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-sourceSize]
--------------------------------------------------
<1> Use batches of 100 documents
Reindex can also use the ingest feature by specifying a `pipeline`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-pipeline]
--------------------------------------------------
<1> set pipeline to `my_pipeline`
+{request}+ also supports a `script` that modifies the document. It allows you to
also change the document's metadata. The following example illustrates that.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-script]
--------------------------------------------------
<1> `setScript` to increment the `likes` field on all documents with user `kimchy`.
+{request}+ supports reindexing from a remote Elasticsearch cluster. When using a remote cluster the query should be
specified inside the `RemoteInfo` object and not using `setSourceQuery`. If both the remote info and the source query are
set it results in a validation error during the request. The reason for this is that the remote Elasticsearch may not
understand queries built by the modern query builders. The remote cluster support works all the way back to Elasticsearch
0.90 and the query language has changed since then. When reaching older versions, it is safer to write the query by hand
in JSON.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-remote]
--------------------------------------------------
<1> set remote elastic cluster
+{request}+ also helps in automatically parallelizing using `sliced-scroll` to
slice on `_id`. Use `setSlices` to specify the number of slices to use.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-slices]
--------------------------------------------------
<1> set number of slices to use
+{request}+ uses the `scroll` parameter to control how long it keeps the
"search context" alive.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-scroll]
--------------------------------------------------
<1> set scroll time
==== Optional arguments
In addition to the options above the following arguments can optionally be also provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the reindex request to be performed as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-refresh]
--------------------------------------------------
<1> Refresh index after calling reindex
include::../execution.asciidoc[]
[id="{upid}-{api}-task-submission"]
==== Reindex task submission
It is also possible to submit a +{request}+ and not wait for it completion with the use of Task API. This is an equivalent of a REST request
with wait_for_completion flag set to false.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{hlrc-tests}/ReindexIT.java[submit-reindex-task]
--------------------------------------------------
<1> A +{request}+ is constructed the same way as for the synchronous method
<2> A submit method returns a `TaskSubmissionResponse` which contains a task identifier.
<3> The task identifier can be used to get `response` from a completed task.
[id="{upid}-{api}-response"]
==== Reindex Response
The returned +{response}+ contains information about the executed operations and
allows to iterate over each result as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Get total time taken
<2> Check if the request timed out
<3> Get total number of docs processed
<4> Number of docs that were updated
<5> Number of docs that were created
<6> Number of docs that were deleted
<7> Number of batches that were executed
<8> Number of skipped docs
<9> Number of version conflicts
<10> Number of times request had to retry bulk index operations
<11> Number of times request had to retry search operations
<12> The total time this request has throttled itself not including the current throttle time if it is currently sleeping
<13> Remaining delay of any current throttle sleep or 0 if not sleeping
<14> Failures during search phase
<15> Failures during bulk index operation

View file

@ -1,79 +0,0 @@
--
:api: rethrottle
:request: RethrottleRequest
:response: ListTasksResponse
--
[id="{upid}-{api}"]
=== Rethrottle API
[id="{upid}-{api}-request"]
==== Rethrottle Request
A +{request}+ can be used to change the current throttling on a running
reindex, update-by-query or delete-by-query task or to disable throttling of
the task entirely. It requires the task Id of the task to change.
In its simplest form, you can use it to disable throttling of a running
task using the following:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-disable-request]
--------------------------------------------------
<1> Create a +{request}+ that disables throttling for a specific task id
By providing a `requestsPerSecond` argument, the request will change the
existing task throttling to the specified value:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Request to change the throttling of a task to 100 requests per second
The rethrottling request can be executed by using one of the three appropriate
methods depending on whether a reindex, update-by-query or delete-by-query task
should be rethrottled:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-execution]
--------------------------------------------------
<1> Execute reindex rethrottling request
<2> The same for update-by-query
<3> The same for delete-by-query
[id="{upid}-{api}-async"]
==== Asynchronous Execution
The asynchronous execution of a rethrottle request requires both the +{request}+
instance and an `ActionListener` instance to be passed to the asynchronous
method:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute-async]
--------------------------------------------------
<1> Execute reindex rethrottling asynchronously
<2> The same for update-by-query
<3> The same for delete-by-query
The asynchronous method does not block and returns immediately.
Once it is completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed. A typical listener looks like this:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-async-listener]
--------------------------------------------------
<1> Code executed when the request is successfully completed
<2> Code executed when the request fails with an exception
[id="{upid}-{api}-response"]
==== Rethrottle Response
Rethrottling returns the task that has been rethrottled in the form of a
+{response}+. The structure of this response object is described in detail
in <<java-rest-high-cluster-list-tasks-response,this section>>.

View file

@ -1,100 +0,0 @@
--
:api: term-vectors
:request: TermVectorsRequest
:response: TermVectorsResponse
--
[id="{upid}-{api}"]
=== Term Vectors API
Term Vectors API returns information and statistics on terms in the fields
of a particular document. The document could be stored in the index or
artificially provided by the user.
[id="{upid}-{api}-request"]
==== Term Vectors Request
A +{request}+ expects an `index` and an `id` to specify
a certain document, and fields for which the information is retrieved.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
Term vectors can also be generated for artificial documents, that is for
documents not present in the index:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-artificial]
--------------------------------------------------
<1> An artificial document is provided as an `XContentBuilder` object,
the Elasticsearch built-in helper to generate JSON content.
===== Optional arguments
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-optional-arguments]
--------------------------------------------------
<1> Set `fieldStatistics` to `false` (default is `true`) to omit document count,
sum of document frequencies, sum of total term frequencies.
<2> Set `termStatistics` to `true` (default is `false`) to display
total term frequency and document frequency.
<3> Set `positions` to `false` (default is `true`) to omit the output of
positions.
<4> Set `offsets` to `false` (default is `true`) to omit the output of
offsets.
<5> Set `payloads` to `false` (default is `true`) to omit the output of
payloads.
<6> Set `filterSettings` to filter the terms that can be returned based
on their tf-idf scores.
<7> Set `perFieldAnalyzer` to specify a different analyzer than
the one that the field has.
<8> Set `realtime` to `false` (default is `true`) to retrieve term vectors
near realtime.
<9> Set a routing parameter
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Term Vectors Response
+{response}+ contains the following information:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The index name of the document.
<2> The id of the document.
<3> Indicates whether or not the document found.
===== Inspecting Term Vectors
If +{response}+ contains non-null list of term vectors,
more information about each term vector can be obtained using the following:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-term-vectors]
--------------------------------------------------
<1> The name of the current field
<2> Fields statistics for the current field - document count
<3> Fields statistics for the current field - sum of total term frequencies
<4> Fields statistics for the current field - sum of document frequencies
<5> Terms for the current field
<6> The name of the term
<7> Term frequency of the term
<8> Document frequency of the term
<9> Total term frequency of the term
<10> Score of the term
<11> Tokens of the term
<12> Position of the token
<13> Start offset of the token
<14> End offset of the token
<15> Payload of the token

View file

@ -1,148 +0,0 @@
--
:api: update-by-query
:request: UpdateByQueryRequest
:response: UpdateByQueryResponse
--
[id="{upid}-{api}"]
=== Update By Query API
[id="{upid}-{api}-request"]
==== Update By Query Request
A +{request}+ can be used to update documents in an index.
It requires an existing index (or a set of indices) on which the update is to
be performed.
The simplest form of a +{request}+ looks like this:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Creates the +{request}+ on a set of indices.
By default version conflicts abort the +{request}+ process but you can just
count them instead with:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-conflicts]
--------------------------------------------------
<1> Set `proceed` on version conflict
You can limit the documents by adding a query.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-query]
--------------------------------------------------
<1> Only copy documents which have field `user` set to `kimchy`
Its also possible to limit the number of processed documents by setting `maxDocs`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-maxDocs]
--------------------------------------------------
<1> Only copy 10 documents
By default +{request}+ uses batches of 1000. You can change the batch size with
`setBatchSize`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-scrollSize]
--------------------------------------------------
<1> Use batches of 100 documents
Update by query can also use the ingest feature by specifying a `pipeline`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-pipeline]
--------------------------------------------------
<1> set pipeline to `my_pipeline`
+{request}+ also supports a `script` that modifies the document:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-script]
--------------------------------------------------
<1> `setScript` to increment the `likes` field on all documents with user `kimchy`.
+{request}+ can be parallelized using `sliced-scroll` with `setSlices`:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-slices]
--------------------------------------------------
<1> set number of slices to use
`UpdateByQueryRequest` uses the `scroll` parameter to control how long it keeps the "search context" alive.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-scroll]
--------------------------------------------------
<1> set scroll time
If you provide routing then the routing is copied to the scroll query, limiting the process to the shards that match
that routing value.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-routing]
--------------------------------------------------
<1> set routing
==== Optional arguments
In addition to the options above the following arguments can optionally be also provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the update by query request to be performed as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-refresh]
--------------------------------------------------
<1> Refresh index after calling update by query
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Set indices options
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Update By Query Response
The returned +{response}+ contains information about the executed operations and
allows to iterate over each result as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Get total time taken
<2> Check if the request timed out
<3> Get total number of docs processed
<4> Number of docs that were updated
<5> Number of docs that were deleted
<6> Number of batches that were executed
<7> Number of skipped docs
<8> Number of version conflicts
<9> Number of times request had to retry bulk index operations
<10> Number of times request had to retry search operations
<11> The total time this request has throttled itself not including the current throttle time if it is currently sleeping
<12> Remaining delay of any current throttle sleep or 0 if not sleeping
<13> Failures during search phase
<14> Failures during bulk index operation

View file

@ -1,237 +0,0 @@
--
:api: update
:request: UpdateRequest
:response: UpdateResponse
--
[id="{upid}-{api}"]
=== Update API
[id="{upid}-{api}-request"]
==== Update Request
An +{request}+ requires the following arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Index
<2> Document id
The Update API allows to update an existing document by using a script
or by passing a partial document.
==== Updates with a script
The script can be provided as an inline script:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-with-inline-script]
--------------------------------------------------
<1> Script parameters provided as a `Map` of objects
<2> Create an inline script using the `painless` language and the previous parameters
<3> Sets the script to the update request
Or as a stored script:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-with-stored-script]
--------------------------------------------------
<1> Reference to a script stored under the name `increment-field` in the `painless` language
<2> Sets the script in the update request
==== Updates with a partial document
When using updates with a partial document, the partial document will be merged with the
existing document.
The partial document can be provided in different ways:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-with-doc-as-string]
--------------------------------------------------
<1> Partial document source provided as a `String` in JSON format
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-with-doc-as-map]
--------------------------------------------------
<1> Partial document source provided as a `Map` which gets automatically converted
to JSON format
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-with-doc-as-xcontent]
--------------------------------------------------
<1> Partial document source provided as an `XContentBuilder` object, the Elasticsearch
built-in helpers to generate JSON content
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-shortcut]
--------------------------------------------------
<1> Partial document source provided as `Object` key-pairs, which gets converted to
JSON format
==== Upserts
If the document does not already exist, it is possible to define some content that
will be inserted as a new document using the `upsert` method:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-upsert]
--------------------------------------------------
<1> Upsert document source provided as a `String`
Similarly to the partial document updates, the content of the `upsert` document
can be defined using methods that accept `String`, `Map`, `XContentBuilder` or
`Object` key-pairs.
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-routing]
--------------------------------------------------
<1> Routing value
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for primary shard to become available as a `TimeValue`
<2> Timeout to wait for primary shard to become available as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-refresh]
--------------------------------------------------
<1> Refresh policy as a `WriteRequest.RefreshPolicy` instance
<2> Refresh policy as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-retry]
--------------------------------------------------
<1> How many times to retry the update operation if the document to update has
been changed by another operation between the get and indexing phases of the
update operation
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-no-source]
--------------------------------------------------
<1> Enable source retrieval, disabled by default
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-source-include]
--------------------------------------------------
<1> Configure source inclusion for specific fields
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-source-exclude]
--------------------------------------------------
<1> Configure source exclusion for specific fields
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-cas]
--------------------------------------------------
<1> ifSeqNo
<2> ifPrimaryTerm
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-detect-noop]
--------------------------------------------------
<1> Disable the noop detection
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-scripted-upsert]
--------------------------------------------------
<1> Indicate that the script must run regardless of whether the document exists or not,
ie the script takes care of creating the document if it does not already exist.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-doc-upsert]
--------------------------------------------------
<1> Indicate that the partial document must be used as the upsert document if it
does not exist yet.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-active-shards]
--------------------------------------------------
<1> Sets the number of shard copies that must be active before proceeding with
the update operation.
<2> Number of shard copies provided as a `ActiveShardCount`: can be `ActiveShardCount.ALL`,
`ActiveShardCount.ONE` or `ActiveShardCount.DEFAULT` (default)
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Update Response
The returned +{response}+ allows to retrieve information about the executed
operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Handle the case where the document was created for the first time (upsert)
<2> Handle the case where the document was updated
<3> Handle the case where the document was deleted
<4> Handle the case where the document was not impacted by the update,
ie no operation (noop) was executed on the document
When the source retrieval is enabled in the `UpdateRequest`
through the fetchSource method, the response contains the
source of the updated document:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-getresult]
--------------------------------------------------
<1> Retrieve the updated document as a `GetResult`
<2> Retrieve the source of the updated document as a `String`
<3> Retrieve the source of the updated document as a `Map<String, Object>`
<4> Retrieve the source of the updated document as a `byte[]`
<5> Handle the scenario where the source of the document is not present in
the response (this is the case by default)
It is also possible to check for shard failures:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-failure]
--------------------------------------------------
<1> Handle the situation where number of successful shards is less than
total shards
<2> Handle the potential failures
When a `UpdateRequest` is performed against a document that does not exist,
the response has `404` status code, an `ElasticsearchException` gets thrown
which needs to be handled as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-docnotfound]
--------------------------------------------------
<1> Handle the exception thrown because the document not exist
If there is a version conflict, an `ElasticsearchException` will
be thrown:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-conflict]
--------------------------------------------------
<1> The raised exception indicates that a version conflict error was returned.

View file

@ -1,31 +0,0 @@
--
:api: enrich-delete-policy
:request: DeletePolicyRequest
:response: AcknowledgedResponse
--
[id="{upid}-{api}"]
=== Delete Policy API
[id="{upid}-{api}-request"]
==== Request
The Delete Policy API deletes an enrich policy from Elasticsearch.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the delete policy request was acknowledged.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether delete policy request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,30 +0,0 @@
--
:api: enrich-execute-policy
:request: ExecutePolicyRequest
:response: ExecutePolicyResponse
--
[id="{upid}-{api}"]
=== Execute Policy API
[id="{upid}-{api}-request"]
==== Request
The Execute Policy API allows to execute an enrich policy by name.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ includes either the status or task id.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
include::../execution.asciidoc[]

View file

@ -1,32 +0,0 @@
--
:api: enrich-get-policy
:request: GetPolicyRequest
:response: GetPolicyResponse
--
[id="{upid}-{api}"]
=== Get Policy API
[id="{upid}-{api}-request"]
==== Request
The Get Policy API allows to retrieve enrich policies by name
or all policies if no name is provided.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ includes the requested enrich policy.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The actual enrich policy.
include::../execution.asciidoc[]

View file

@ -1,31 +0,0 @@
--
:api: enrich-put-policy
:request: PutPolicyRequest
:response: AcknowledgedResponse
--
[id="{upid}-{api}"]
=== Create enrich policy API
[id="{upid}-{api}-request"]
==== Request
Creates an enrich policy.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The +{response}+ indicates if the request was acknowledged.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether the request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,33 +0,0 @@
--
:api: enrich-stats
:request: StatsRequest
:response: StatsResponse
--
[id="{upid}-{api}"]
=== Stats API
[id="{upid}-{api}-request"]
==== Request
The stats API returns enrich related stats.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ includes enrich related stats.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> List of policies that are currently executing with
additional details.
<2> List of coordinator stats per ingest node.
include::../execution.asciidoc[]

View file

@ -1,55 +0,0 @@
////
This file is included by high level rest client API documentation pages
where the client method does not use a request object.
For methods with requests, see execution.asciidoc
////
[id="{upid}-{api}-sync"]
==== Synchronous execution
When executing the +{api}+ API in the following manner, the client waits
for the +{response}+ to be returned before continuing with code execution:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute]
--------------------------------------------------
Synchronous calls may throw an `IOException` in case of either failing to
parse the REST response in the high-level REST client, the request times out
or similar cases where there is no response coming back from the server.
In cases where the server returns a `4xx` or `5xx` error code, the high-level
client tries to parse the response body error details instead and then throws
a generic `ElasticsearchException` and adds the original `ResponseException` as a
suppressed exception to it.
[id="{upid}-{api}-async"]
==== Asynchronous execution
The +{api}+ API can also be called in an asynchronous fashion so that
the client can return directly. Users need to specify how the response or
potential failures will be handled by passing a listener to the
asynchronous {api} method:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute-async]
--------------------------------------------------
<1> The `RequestOptions` and `ActionListener` to use when the execution
completes
The asynchronous method does not block and returns immediately. Once it is
completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed. Failure scenarios and expected exceptions are the same as in the
synchronous execution case.
A typical listener for +{api}+ looks like:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute-listener]
--------------------------------------------------
<1> Called when the execution is successfully completed.
<2> Called when the +{api}+ call fails.

View file

@ -1,58 +0,0 @@
////
This file is included by every high level rest client API documentation page
so we don't have to copy and paste the same asciidoc over and over again. We
*do* have to copy and paste the same Java tests over and over again. For now
this is intentional because it forces us to *write* and execute the tests
which, while a bit ceremonial, does force us to cover these calls in *some*
test.
////
[id="{upid}-{api}-sync"]
==== Synchronous execution
When executing a +{request}+ in the following manner, the client waits
for the +{response}+ to be returned before continuing with code execution:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute]
--------------------------------------------------
Synchronous calls may throw an `IOException` in case of either failing to
parse the REST response in the high-level REST client, the request times out
or similar cases where there is no response coming back from the server.
In cases where the server returns a `4xx` or `5xx` error code, the high-level
client tries to parse the response body error details instead and then throws
a generic `ElasticsearchException` and adds the original `ResponseException` as a
suppressed exception to it.
[id="{upid}-{api}-async"]
==== Asynchronous execution
Executing a +{request}+ can also be done in an asynchronous fashion so that
the client can return directly. Users need to specify how the response or
potential failures will be handled by passing the request and a listener to the
asynchronous {api} method:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute-async]
--------------------------------------------------
<1> The +{request}+ to execute and the `ActionListener` to use when
the execution completes
The asynchronous method does not block and returns immediately. Once it is
completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed. Failure scenarios and expected exceptions are the same as in the
synchronous execution case.
A typical listener for +{api}+ looks like:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-execute-listener]
--------------------------------------------------
<1> Called when the execution is successfully completed.
<2> Called when the whole +{request}+ fails.

View file

@ -1,197 +0,0 @@
[[java-rest-high-getting-started]]
== Getting started
This section describes how to get started with the high-level REST client from
getting the artifact to using it in an application.
[[java-rest-high-compatibility]]
=== Compatibility
The Java High Level REST Client requires at least Java 1.8 and depends on the Elasticsearch
core project. The client version is the same as the Elasticsearch version that the
client was developed for. It accepts the same request arguments as the `TransportClient`
and returns the same response objects. See the <<java-rest-high-level-migration>>
if you need to migrate an application from `TransportClient` to the new REST client.
The High Level Client is guaranteed to be able to communicate with any Elasticsearch
node running on the same major version and greater or equal minor version. It
doesn't need to be in the same minor version as the Elasticsearch nodes it
communicates with, as it is forward compatible meaning that it supports
communicating with later versions of Elasticsearch than the one it was developed for.
The 6.0 client is able to communicate with any 6.x Elasticsearch node, while the 6.1
client is for sure able to communicate with 6.1, 6.2 and any later 6.x version, but
there may be incompatibility issues when communicating with a previous Elasticsearch
node version, for instance between 6.1 and 6.0, in case the 6.1 client supports new
request body fields for some APIs that are not known by the 6.0 node(s).
It is recommended to upgrade the High Level Client when upgrading the Elasticsearch
cluster to a new major version, as REST API breaking changes may cause unexpected
results depending on the node that is hit by the request, and newly added APIs will
only be supported by the newer version of the client. The client should always be
updated last, once all of the nodes in the cluster have been upgraded to the new
major version.
[[java-rest-high-javadoc]]
=== Javadoc
The javadoc for the REST high level client can be found at {rest-high-level-client-javadoc}/index.html.
[[java-rest-high-getting-started-maven]]
=== Maven Repository
The high-level Java REST client is hosted on
https://search.maven.org/search?q=g:org.elasticsearch.client[Maven
Central]. The minimum Java version required is `1.8`.
The High Level REST Client is subject to the same release cycle as
Elasticsearch. Replace the version with the desired client version.
If you are looking for a SNAPSHOT version, you should add our snapshot repository to your Maven config:
["source","xml",subs="attributes"]
--------------------------------------------------
<repositories>
<repository>
<id>es-snapshots</id>
<name>elasticsearch snapshot repo</name>
<url>https://snapshots.elastic.co/maven/</url>
</repository>
</repositories>
--------------------------------------------------
or in Gradle:
["source","groovy",subs="attributes"]
--------------------------------------------------
maven {
url "https://snapshots.elastic.co/maven/"
}
--------------------------------------------------
[[java-rest-high-getting-started-maven-maven]]
==== Maven configuration
Here is how you can configure the dependency using maven as a dependency manager.
Add the following to your `pom.xml` file:
["source","xml",subs="attributes"]
--------------------------------------------------
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>{version}</version>
</dependency>
--------------------------------------------------
[[java-rest-high-getting-started-maven-gradle]]
==== Gradle configuration
Here is how you can configure the dependency using gradle as a dependency manager.
Add the following to your `build.gradle` file:
["source","groovy",subs="attributes"]
--------------------------------------------------
dependencies {
compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:{version}'
}
--------------------------------------------------
[[java-rest-high-getting-started-maven-lucene]]
==== Lucene Snapshot repository
The very first releases of any major version (like a beta), might have been built on top of a Lucene Snapshot version.
In such a case you will be unable to resolve the Lucene dependencies of the client.
For example, if you want to use the `7.0.0-beta1` version which depends on Lucene `8.0.0-snapshot-83f9835`, you must
define the following repository.
For Maven:
["source","xml",subs="attributes"]
--------------------------------------------------
<repository>
<id>elastic-lucene-snapshots</id>
<name>Elastic Lucene Snapshots</name>
<url>https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/83f9835</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
--------------------------------------------------
For Gradle:
["source","groovy",subs="attributes"]
--------------------------------------------------
maven {
name 'lucene-snapshots'
url 'https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/83f9835'
}
--------------------------------------------------
[[java-rest-high-getting-started-dependencies]]
=== Dependencies
The High Level Java REST Client depends on the following artifacts and their
transitive dependencies:
- org.elasticsearch.client:elasticsearch-rest-client
- org.elasticsearch:elasticsearch
[[java-rest-high-getting-started-initialization]]
=== Initialization
A `RestHighLevelClient` instance needs a <<java-rest-low-usage-initialization,REST low-level client builder>>
to be built as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[rest-high-level-client-init]
--------------------------------------------------
The high-level client will internally create the low-level client used to
perform requests based on the provided builder. That low-level client
maintains a pool of connections and starts some threads so you should
close the high-level client when you are well and truly done with
it and it will in turn close the internal low-level client to free those
resources. This can be done through the `close`:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[rest-high-level-client-close]
--------------------------------------------------
In the rest of this documentation about the Java High Level Client, the `RestHighLevelClient` instance
will be referenced as `client`.
[[java-rest-high-getting-started-request-options]]
=== RequestOptions
All APIs in the `RestHighLevelClient` accept a `RequestOptions` which you can
use to customize the request in ways that won't change how Elasticsearch
executes the request. For example, this is the place where you'd specify a
`NodeSelector` to control which node receives the request. See the
<<java-rest-low-usage-request-options,low level client documentation>> for
more examples of customizing the options.
[[java-rest-high-getting-started-asynchronous-usage]]
=== Asynchronous usage
All of the methods across the different clients exist in a traditional synchronous and
asynchronous variant. The difference is that the asynchronous ones use asynchronous requests
in the REST Low Level Client. This is useful if you are doing multiple requests or are using e.g.
rx java, Kotlin co-routines, or similar frameworks.
The asynchronous methods are recognizable by the fact that they have the word "Async" in their name
and return a `Cancellable` instance. The asynchronous methods accept the same request object
as the synchronous variant and accept a generic `ActionListener<T>` where `T` is the return
type of the synchronous method.
All asynchronous methods return a `Cancellable` object with a `cancel` method that you may call
in case you want to abort the request. Cancelling
no longer needed requests is a good way to avoid putting unnecessary
load on Elasticsearch.
Using the `Cancellable` instance is optional and you can safely ignore this if you have
no need for this. A use case for this would be using this with e.g. Kotlin's `suspendCancellableCoRoutine`.

View file

@ -1,54 +0,0 @@
[role="xpack"]
[[java-rest-high-x-pack-graph-explore]]
=== Graph explore API
[[java-rest-high-x-pack-graph-explore-execution]]
==== Initial request
Graph queries are executed using the `explore()` method:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/GraphDocumentationIT.java[x-pack-graph-explore-request]
--------------------------------------------------
<1> In this example we seed the exploration with a query to find messages mentioning the mysterious `projectx`
<2> What we want to discover in these messages are the ids of `participants` in the communications and the md5 hashes
of any attached files. In each case, we want to find people or files that have had at least one document connecting them
to projectx.
<3> The next "hop" in the graph exploration is to find the people who have shared several messages with the people or files
discovered in the previous hop (the projectx conspirators). The `minDocCount` control is used here to ensure the people
discovered have had at least 5 communications with projectx entities. Note we could also supply a "guiding query" here e.g. a
date range to consider only recent communications but we pass null to consider all connections.
<4> Finally we call the graph explore API with the GraphExploreRequest object.
==== Response
Graph responses consist of Vertex and Connection objects (aka "nodes" and "edges" respectively):
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/GraphDocumentationIT.java[x-pack-graph-explore-response]
--------------------------------------------------
<1> Each Vertex is a unique term (a combination of fieldname and term value). The "hopDepth" property tells us at which point in the
requested exploration this term was first discovered.
<2> Each Connection is a pair of Vertex objects and includes a docCount property telling us how many times these two
Vertex terms have been sighted together
[[java-rest-high-x-pack-graph-expand-execution]]
==== Expanding a client-side Graph
Typically once an application has rendered an initial GraphExploreResponse as a collection of vertices and connecting lines (graph visualization toolkits such as D3, sigma.js or Keylines help here) the next step a user may want to do is "expand". This involves finding new vertices that might be connected to the existing ones currently shown.
To do this we use the same `explore` method but our request contains details about which vertices to expand from and which vertices to avoid re-discovering.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/GraphDocumentationIT.java[x-pack-graph-explore-expand]
--------------------------------------------------
<1> Unlike the initial request we do not need to pass a starting query
<2> In the first hop which represents our "from" vertices we explicitly list the terms that we already have on-screen and want to expand by using the `addInclude` filter.
We can supply a boost for those terms that are considered more important to follow than others but here we select a common value of 1 for all.
<3> When defining the second hop which represents the "to" vertices we hope to discover we explicitly list the terms that we already know about using the `addExclude` filter

View file

@ -1,36 +0,0 @@
--
:api: ilm-delete-lifecycle-policy
:request: DeleteLifecyclePolicyRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Delete Lifecycle Policy API
[id="{upid}-{api}-request"]
==== Request
The Delete Lifecycle Policy API allows you to delete an Index Lifecycle
Management Policy from the cluster.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The policy named `my_policy` will be deleted.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the delete lifecycle policy request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the delete lifecycle policy request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,36 +0,0 @@
--
:api: slm-delete-snapshot-lifecycle-policy
:request: DeleteSnapshotLifecyclePolicyRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Delete Snapshot Lifecycle Policy API
[id="{upid}-{api}-request"]
==== Request
The Delete Snapshot Lifecycle Policy API allows you to delete a Snapshot Lifecycle Management Policy
from the cluster.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The policy with the id `policy_id` will be deleted.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the delete snapshot lifecycle policy request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the delete snapshot lifecycle policy request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,36 +0,0 @@
--
:api: slm-execute-snapshot-lifecycle-policy
:request: ExecuteSnapshotLifecyclePolicyRequest
:response: ExecuteSnapshotLifecyclePolicyResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Execute Snapshot Lifecycle Policy API
[id="{upid}-{api}-request"]
==== Request
The Execute Snapshot Lifecycle Policy API allows you to execute a Snapshot Lifecycle Management
Policy, taking a snapshot immediately.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The policy id to execute
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ contains the name of the snapshot that was created.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The created snapshot name
include::../execution.asciidoc[]

View file

@ -1,35 +0,0 @@
--
:api: slm-execute-snapshot-lifecycle-retention
:request: ExecuteSnapshotLifecycleRetentionRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Execute Snapshot Lifecycle Retention API
[id="{upid}-{api}-request"]
==== Request
The Execute Snapshot Lifecycle Retention API allows you to execute Snapshot Lifecycle Management
Retention immediately, rather than waiting for its regularly scheduled execution.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ contains a boolean for whether the request was
acknowledged by the master node.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
include::../execution.asciidoc[]

View file

@ -1,50 +0,0 @@
--
:api: ilm-explain-lifecycle
:request: ExplainLifecycleRequest
:response: ExplainLifecycleResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Explain Lifecycle API
[id="{upid}-{api}-request"]
==== Request
The Explain Lifecycle API allows you to retrieve information about the execution
of a Lifecycle Policy with respect to one or more indices.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Requests an explanation of policy execution for `my_index` and `other_index`
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ contains a map of `LifecyclePolicyMetadata`,
accessible by the name of the policy, which contains data about each policy,
as well as the policy definition.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The name of the policy in use for this index, if any. Will be `null` if the
index does not have an associated policy.
<2> Indicates whether this index is being managed by Index Lifecycle Management.
<3> The Phase (`hot`, `warm`, etc.) this index is currently in. Will be `null` if
the index is not managed by Index Lifecycle Management.
<4> The time this index entered this Phase of execution.
<5> The Action (`rollover`, `shrink`, etc.) this index is currently in. Will be `null` if
the index is not managed by Index Lifecycle Management.
<6> The Step this index is currently in. Will be `null` if
the index is not managed by Index Lifecycle Management.
<7> If this index is in the `ERROR` Step, this will indicate which Step failed.
Otherwise, it will be `null`.
include::../execution.asciidoc[]

View file

@ -1,40 +0,0 @@
--
:api: ilm-get-lifecycle-policy
:request: GetLifecyclePolicyRequest
:response: GetLifecyclePolicyResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get Lifecycle Policy API
[id="{upid}-{api}-request"]
==== Request
The Get Lifecycle Policy API allows you to retrieve the definition of an Index
Lifecycle Management Policy from the cluster.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Gets all policies.
<2> Gets `my_policy` and `other_policy`
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ contains a map of `LifecyclePolicyMetadata`,
accessible by the name of the policy, which contains data about each policy,
as well as the policy definition.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The retrieved policies are retrieved by name.
<2> The policy definition itself.
include::../execution.asciidoc[]

View file

@ -1,39 +0,0 @@
--
:api: slm-get-snapshot-lifecycle-policy
:request: GetSnapshotLifecyclePolicyRequest
:response: GetSnapshotLifecyclePolicyResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get Snapshot Lifecycle Policy API
[id="{upid}-{api}-request"]
==== Request
The Get Snapshot Lifecycle Policy API allows you to retrieve the definition of a Snapshot Lifecycle
Management Policy from the cluster.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Gets all policies.
<2> Gets `policy_id`
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ contains a map of `SnapshotLifecyclePolicyMetadata`, accessible by the id
of the policy, which contains data about each policy, as well as the policy definition.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The retrieved policies are retrieved by id.
<2> The policy definition itself.
include::../execution.asciidoc[]

View file

@ -1,35 +0,0 @@
--
:api: slm-get-snapshot-lifecycle-stats
:request: GetSnapshotLifecycleStatsRequest
:response: GetSnapshotLifecycleStatsResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get Snapshot Lifecycle Stats API
[id="{upid}-{api}-request"]
==== Request
The Get Snapshot Lifecycle Stats API allows you to retrieve statistics about snapshots taken or
deleted, as well as retention runs by the snapshot lifecycle service.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ contains global statistics as well as a map of `SnapshotPolicyStats`,
accessible by the id of the policy, which contains statistics about each policy.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
include::../execution.asciidoc[]

View file

@ -1,36 +0,0 @@
--
:api: ilm-status
:request: LifecycleManagementStatusRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Index Lifecycle Management Status API
[id="{upid}-{api}-request"]
==== Request
The Index Lifecycle Management Status API allows you to retrieve the status
of Index Lifecycle Management
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates the status of Index Lifecycle Management.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The returned status can be `RUNNING`, `STOPPING`, or `STOPPED`.
include::../execution.asciidoc[]

View file

@ -1,36 +0,0 @@
--
:api: ilm-put-lifecycle-policy
:request: PutLifecyclePolicyRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Create or update lifecycle policy API
[id="{upid}-{api}-request"]
==== Request
Creates or updates an index lifecycle management policy.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Adds a hot phase with a rollover action
<2> Adds a delete phase that will delete in the index 90 days after rollover
<3> Creates the policy with the defined phases and the name `my_policy`
[id="{upid}-{api}-response"]
==== Response
The +{response}+ indicates if the request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,33 +0,0 @@
--
:api: slm-put-snapshot-lifecycle-policy
:request: PutSnapshotLifecyclePolicyRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Create or update snapshot lifecycle policy API
[id="{upid}-{api}-request"]
==== Request
Creates or updates a snapshot lifecycle management policy.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The +{response}+ indicates if the request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,38 +0,0 @@
--
:api: ilm-remove-lifecycle-policy-from-index
:request: RemoveIndexLifecyclePolicyRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Remove Policy from Index API
[id="{upid}-{api}-request"]
==== Request
Removes the assigned lifecycle policy from an index.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> removes the `my_policy` policy from `my_index`
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the request to remove
the lifecycle policy from the index was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not there were any policies failed
to be removed from any indices from the request
<2> A list of index names which are still managed
by their policies.
include::../execution.asciidoc[]

View file

@ -1,36 +0,0 @@
--
:api: ilm-retry-lifecycle-policy
:request: RetryLifecyclePolicyRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Retry Lifecycle Policy API
[id="{upid}-{api}-request"]
==== Request
The Retry Lifecycle Policy API allows you to invoke execution of policies
that encountered errors in certain indices.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Retries execution of `my_index`'s policy
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the retry lifecycle policy request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the lifecycle policy retry was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,36 +0,0 @@
--
:api: slm-status
:request: SnapshotLifecycleManagementStatusRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Snapshot Lifecycle Management Status API
[id="{upid}-{api}-request"]
==== Request
The Snapshot Lifecycle Management Status API allows you to retrieve the status
of Snapshot Lifecycle Management
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates the status of Snapshot Lifecycle Management.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The returned status can be `RUNNING`, `STOPPING`, or `STOPPED`.
include::../execution.asciidoc[]

View file

@ -1,36 +0,0 @@
--
:api: ilm-start-ilm
:request: StartILMRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Start Index Lifecycle Management API
[id="{upid}-{api}-request"]
==== Request
The Start Lifecycle Management API allows you to start Index Lifecycle
Management if it has previously been stopped.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the request to start Index Lifecycle
Management was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the request to start Index Lifecycle Management was
acknowledged.
include::../execution.asciidoc[]

View file

@ -1,36 +0,0 @@
--
:api: slm-start-slm
:request: StartSLMRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Start Snapshot Lifecycle Management API
[id="{upid}-{api}-request"]
==== Request
The Start Snapshot Lifecycle Management API allows you to start Snapshot
Lifecycle Management if it has previously been stopped.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the request to start Snapshot Lifecycle
Management was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the request to start Snapshot Lifecycle Management was
acknowledged.
include::../execution.asciidoc[]

View file

@ -1,38 +0,0 @@
--
:api: ilm-stop-ilm
:request: StopILMRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Stop Index Lifecycle Management API
[id="{upid}-{api}-request"]
==== Request
The Stop Lifecycle Management API allows you to stop Index Lifecycle
Management temporarily.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the request to stop Index Lifecycle
Management was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the request to stop Index Lifecycle Management was
acknowledged.
include::../execution.asciidoc[]

View file

@ -1,38 +0,0 @@
--
:api: slm-stop-slm
:request: StopSLMRequest
:response: AcknowledgedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Stop Snapshot Lifecycle Management API
[id="{upid}-{api}-request"]
==== Request
The Stop Snapshot Management API allows you to stop Snapshot Lifecycle
Management temporarily.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the request to stop Snapshot
Lifecycle Management was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the request to stop Snapshot Lifecycle Management was
acknowledged.
include::../execution.asciidoc[]

View file

@ -1,38 +0,0 @@
:mainid: java-rest-high
[id="{mainid}"]
= Java High Level REST Client
[partintro]
--
deprecated[7.15.0, The High Level REST Client is deprecated in favour of the {java-api-client}/index.html[Java API Client].]
The Java High Level REST Client works on top of the Java Low Level REST client.
Its main goal is to expose API specific methods, that accept request objects as
an argument and return response objects, so that request marshalling and
response un-marshalling is handled by the client itself.
Each API can be called synchronously or asynchronously. The synchronous
methods return a response object, while the asynchronous methods, whose names
end with the `async` suffix, require a listener argument that is notified
(on the thread pool managed by the low level client) once a response or an
error is received.
The Java High Level REST Client depends on the Elasticsearch core project.
It accepts the same request arguments as the `TransportClient` and returns
the same response objects.
--
:doc-tests: {elasticsearch-root}/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation
:hlrc-tests: {elasticsearch-root}/client/rest-high-level/src/test/java/org/elasticsearch/client
include::getting-started.asciidoc[]
include::supported-apis.asciidoc[]
include::java-builders.asciidoc[]
include::migration.asciidoc[]
include::../license.asciidoc[]
:doc-tests!:
:mainid!:

View file

@ -1,97 +0,0 @@
--
:api: analyze
:request: AnalyzeRequest
:response: AnalyzeResponse
--
[id="{upid}-{api}"]
=== Analyze API
[id="{upid}-{api}-request"]
==== Analyze Request
An +{request}+ contains the text to analyze, and one of several options to
specify how the analysis should be performed.
The simplest version uses a built-in analyzer:
["source","java",subs="attributes,callouts,macros"]
---------------------------------------------------
include-tagged::{doc-tests-file}[{api}-builtin-request]
---------------------------------------------------
<1> A built-in analyzer
<2> The text to include. Multiple strings are treated as a multi-valued field
You can configure a custom analyzer:
["source","java",subs="attributes,callouts,macros"]
---------------------------------------------------
include-tagged::{doc-tests-file}[{api}-custom-request]
---------------------------------------------------
<1> Configuration for a custom tokenfilter
<2> Configure the tokenizer
<3> Configure char filters
<4> Add a built-in tokenfilter
<5> Add the custom tokenfilter
You can also build a custom normalizer, by including only charfilters and
tokenfilters:
["source","java",subs="attributes,callouts,macros"]
---------------------------------------------------
include-tagged::{doc-tests-file}[{api}-custom-normalizer-request]
---------------------------------------------------
You can analyze text using an analyzer defined in an existing index:
["source","java",subs="attributes,callouts,macros"]
---------------------------------------------------
include-tagged::{doc-tests-file}[{api}-index-request]
---------------------------------------------------
<1> The index containing the mappings
<2> The analyzer defined on this index to use
Or you can use a normalizer:
["source","java",subs="attributes,callouts,macros"]
---------------------------------------------------
include-tagged::{doc-tests-file}[{api}-index-normalizer-request]
---------------------------------------------------
<1> The index containing the mappings
<2> The normalizer defined on this index to use
You can analyze text using the mappings for a particular field in an index:
["source","java",subs="attributes,callouts,macros"]
---------------------------------------------------
include-tagged::{doc-tests-file}[{api}-field-request]
---------------------------------------------------
==== Optional arguments
The following arguments can also optionally be provided:
["source","java",subs="attributes,callouts,macros"]
---------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-explain]
---------------------------------------------------
<1> Setting `explain` to true will add further details to the response
<2> Setting `attributes` allows you to return only token attributes that you are
interested in
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Analyze Response
The returned +{response}+ allows you to retrieve details of the analysis as
follows:
["source","java",subs="attributes,callouts,macros"]
---------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-tokens]
---------------------------------------------------
<1> `AnalyzeToken` holds information about the individual tokens produced by analysis
If `explain` was set to `true`, then information is instead returned from the `detail()`
method:
["source","java",subs="attributes,callouts,macros"]
---------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-detail]
---------------------------------------------------
<1> `DetailAnalyzeResponse` holds more detailed information about tokens produced by
the various substeps in the analysis chain.

View file

@ -1,80 +0,0 @@
--
:api: clear-cache
:request: ClearIndicesCacheRequest
:response: ClearIndicesCacheResponse
--
[id="{upid}-{api}"]
=== Clear Cache API
[id="{upid}-{api}-request"]
==== Clear Cache Request
A +{request}+ can be applied to one or more indices, or even on
`_all` the indices:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Clears the cache of one index
<2> Clears the cache of multiple indices
<3> Clears the cache of all the indices
==== Optional arguments
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-query]
--------------------------------------------------
<1> Set the `query` flag to `true`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-fielddata]
--------------------------------------------------
<1> Set the `fielddata` flag to `true`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-request]
--------------------------------------------------
<1> Set the `request` flag to `true`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-fields]
--------------------------------------------------
<1> Set the `fields` parameter
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Clear Cache Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Total number of shards hit by the clear cache request
<2> Number of shards where the clear cache has succeeded
<3> Number of shards where the clear cache has failed
<4> A list of failures if the operation failed on one or more shards
By default, if the indices were not found, an `ElasticsearchException` will be thrown:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-notfound]
--------------------------------------------------
<1> Do something if the indices to be cleared were not found

View file

@ -1,80 +0,0 @@
--
:api: clone-index
:request: ResizeRequest
:response: ResizeResponse
--
[id="{upid}-{api}"]
=== Clone Index API
[id="{upid}-{api}-request"]
==== Resize Request
The Clone Index API requires a +{request}+ instance.
A +{request}+ requires two string arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The target index (first argument) to clone the source index (second argument) into
<2> The resize type needs to be set to `CLONE`
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-waitForActiveShards]
--------------------------------------------------
<1> The number of active shard copies to wait for before the clone index API
returns a response, as an `int`
<2> The number of active shard copies to wait for before the clone index API
returns a response, as an `ActiveShardCount`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-settings]
--------------------------------------------------
<1> The settings to apply to the target index, which optionally include the
number of shards to create for it
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-aliases]
--------------------------------------------------
<1> The aliases to associate the target index with
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Clone Index Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for
each shard in the index before timing out

View file

@ -1,56 +0,0 @@
--
:api: close-index
:request: CloseIndexRequest
:response: CloseIndexResponse
--
[id="{upid}-{api}"]
=== Close Index API
[id="{upid}-{api}-request"]
==== Close Index Request
A +{request}+ requires an `index` argument:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The index to close
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is closed
as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Close Index Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request

View file

@ -1,116 +0,0 @@
--
:api: create-index
:request: CreateIndexRequest
:response: CreateIndexResponse
--
[id="{upid}-{api}"]
=== Create Index API
[id="{upid}-{api}-request"]
==== Create Index Request
A +{request}+ requires an `index` argument:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The index to create
==== Index settings
Each index created can have specific settings associated with it.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-settings]
--------------------------------------------------
<1> Settings for this index
[[java-rest-high-create-index-request-mappings]]
==== Index mappings
An index may be created with mappings for its document types
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-mappings]
--------------------------------------------------
<1> The type to define
<2> The mapping for this type, provided as a JSON string
The mapping source can be provided in different ways in addition to the
`String` example shown above:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-mappings-map]
--------------------------------------------------
<1> Mapping source provided as a `Map` which gets automatically converted
to JSON format
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-mappings-xcontent]
--------------------------------------------------
<1> Mapping source provided as an `XContentBuilder` object, the Elasticsearch
built-in helpers to generate JSON content
==== Index aliases
Aliases can be set at index creation time
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-aliases]
--------------------------------------------------
<1> The alias to define
==== Providing the whole source
The whole source including all of its sections (mappings, settings and aliases)
can also be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-whole-source]
--------------------------------------------------
<1> The source provided as a JSON string. It can also be provided as a `Map`
or an `XContentBuilder`.
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index creation as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-waitForActiveShards]
--------------------------------------------------
<1> The number of active shard copies to wait for before the create index API returns a
response, as an `int`
<2> The number of active shard copies to wait for before the create index API returns a
response, as an `ActiveShardCount`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Create Index Response
The returned +{response}+ allows to retrieve information about the executed
operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for each shard in the index before timing out

View file

@ -1,49 +0,0 @@
--
:api: delete-alias
:request: DeleteAliasRequest
:response: AcknowledgedResponse
--
[id="{upid}-{api}"]
=== Delete Alias API
[id="{upid}-{api}-request"]
==== Delete Alias Request
An +{request}+ requires an `index` and an `alias` argument:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
[id="{upid}-{api}-response"]
==== Delete Alias Response
The returned +{response}+ indicates if the request to delete the alias
was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the request to delete the alias was
acknowledged.
include::../execution.asciidoc[]

View file

@ -1,65 +0,0 @@
--
:api: delete-index
:request: DeleteIndexRequest
:response: DeleteIndexResponse
--
[id="{upid}-{api}"]
=== Delete Index API
[id="{upid}-{api}-request"]
==== Delete Index Request
A +{request}+ requires an `index` argument:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Index
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index deletion as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the index deletion as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Delete Index Response
The returned +{response}+ allows to retrieve information about the executed
operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
If the index was not found, an `ElasticsearchException` will be thrown:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-notfound]
--------------------------------------------------
<1> Do something if the index to be deleted was not found

View file

@ -1,41 +0,0 @@
--
:api: delete-index-template-v2
:request: DeleteIndexTemplateV2Request
:response: AcknowledgedResponse
--
[id="{upid}-{api}"]
=== Delete Composable Index Template API
[id="{upid}-{api}-request"]
==== Request
The Delete Composable Index Template API allows you to delete an index template.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of an index template to delete.
=== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the delete template request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the delete template request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,32 +0,0 @@
--
:api: delete-template
:request: DeleteIndexTemplateRequest
:response: AcknowledgedResponse
--
[id="{upid}-{api}"]
=== Delete Template API
[id="{upid}-{api}-request"]
==== Request
The Delete Template API allows you to delete an index template.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of an index template to delete.
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ indicates if the delete template request was received.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Whether or not the delete template request was acknowledged.
include::../execution.asciidoc[]

View file

@ -1,58 +0,0 @@
--
:api: exists-alias
:request: GetAliasesRequest
:response: Boolean
--
[id="{upid}-{api}"]
=== Exists Alias API
[id="{upid}-{api}-request"]
==== Exists Alias Request
The Exists Alias API uses +{request}+ as its request object.
One or more aliases can be optionally provided either at construction
time or later on through the relevant setter method.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-alias]
--------------------------------------------------
<1> One or more aliases to look for
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indices]
--------------------------------------------------
<1> The index or indices that the alias is associated with
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-local]
--------------------------------------------------
<1> The `local` flag (defaults to `false`) controls whether the aliases need
to be looked up in the local cluster state or in the cluster state held by
the elected master node
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Exists Alias Response
The Exists Alias API returns a +{response}+ that indicates whether the provided
alias (or aliases) was found or not.

View file

@ -1,67 +0,0 @@
--
:api: flush
:request: FlushRequest
:response: FlushResponse
--
[id="{upid}-{api}"]
=== Flush API
[id="{upid}-{api}-request"]
==== Flush Request
A +{request}+ can be applied to one or more indices, or even on `_all` the indices:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Flush one index
<2> Flush multiple indices
<3> Flush all the indices
==== Optional arguments
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-wait]
--------------------------------------------------
<1> Set the `wait_if_ongoing` flag to `true`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-force]
--------------------------------------------------
<1> Set the `force` flag to `true`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Flush Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Total number of shards hit by the flush request
<2> Number of shards where the flush has succeeded
<3> Number of shards where the flush has failed
<4> A list of failures if the operation failed on one or more shards
By default, if the indices were not found, an `ElasticsearchException` will be thrown:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-notfound]
--------------------------------------------------
<1> Do something if the indices to be flushed were not found

View file

@ -1,73 +0,0 @@
--
:api: force-merge
:request: ForceMergeRequest
:response: ForceMergeResponse
--
[id="{upid}-{api}"]
=== Force Merge API
[id="{upid}-{api}-request"]
==== Force merge Request
A +{request}+ can be applied to one or more indices, or even on `_all` the indices:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Force merge one index
<2> Force merge multiple indices
<3> Force merge all the indices
==== Optional arguments
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-segments-num]
--------------------------------------------------
<1> Set `max_num_segments` to control the number of segments to merge down to.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-only-expunge-deletes]
--------------------------------------------------
<1> Set the `only_expunge_deletes` flag to `true`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-flush]
--------------------------------------------------
<1> Set the `flush` flag to `true`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Force Merge Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Total number of shards hit by the force merge request
<2> Number of shards where the force merge has succeeded
<3> Number of shards where the force merge has failed
<4> A list of failures if the operation failed on one or more shards
By default, if the indices were not found, an `ElasticsearchException` will be thrown:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-notfound]
--------------------------------------------------
<1> Do something if the indices to be force merged were not found

View file

@ -1,65 +0,0 @@
--
:api: freeze-index
:request: FreezeIndexRequest
:response: FreezeIndexResponse
--
[id="{upid}-{api}"]
=== Freeze Index API
[id="{upid}-{api}-request"]
==== Freeze Index Request
An +{request}+ requires an `index` argument:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The index to freeze
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is frozen
as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-waitForActiveShards]
--------------------------------------------------
<1> The number of active shard copies to wait for before the freeze index API
returns a response, as an `ActiveShardCount`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Freeze Index Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for
each shard in the index before timing out

View file

@ -1,85 +0,0 @@
--
:api: get-alias
:request: GetAliasesRequest
:response: GetAliasesResponse
--
[id="{upid}-{api}"]
=== Get Alias API
[id="{upid}-{api}-request"]
==== Get Alias Request
The Get Alias API uses +{request}+ as its request object.
One or more aliases can be optionally provided either at construction
time or later on through the relevant setter method.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-alias]
--------------------------------------------------
<1> One or more aliases to retrieve
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indices]
--------------------------------------------------
<1> The index or indices that the alias is associated with
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded when looking for aliases that belong to
specified indices.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-local]
--------------------------------------------------
<1> The `local` flag (defaults to `false`) controls whether the aliases need
to be looked up in the local cluster state or in the cluster state held by
the elected master node
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Alias Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Retrieves a map of indices and their aliases
+{response}+ class contains information about errors if they occurred.
This info could be in fields `error` or `exception` depends on a case.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response-error]
--------------------------------------------------
<1> Client sets status to `NOT_FOUND` if at least one item of specified
indices or aliases is not found. Otherwise it is `OK`.
<2> If at least one item of specified indices isn't exist client sets
`ElasticsearchException` and returns empty result.
<3> If at least one item of specified aliases ins't exist client puts
error description in `error` field and returns partial result if any
of other patterns match.
If user specified indices or aliases as regular expressions
and nothing was found client returns `OK` status and no errors.

View file

@ -1,51 +0,0 @@
--
:api: get-field-mappings
:request: GetFieldMappingsRequest
:response: GetFieldMappingsResponse
--
[id="{upid}-{api}"]
=== Get Field Mappings API
[id="{upid}-{api}-request"]
==== Get Field Mappings Request
A +{request}+ can have an optional list of indices, optional list of types and the list of fields:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> An empty request
<2> Setting the indices to fetch mapping for
<3> The fields to be returned
==== Optional arguments
The following arguments can also optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Field Mappings Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Returning all requested indices fields' mappings
<2> Retrieving the mappings for a particular index
<3> Getting the mappings metadata for the `message` field
<4> Getting the full name of the field
<5> Getting the mapping source of the field

View file

@ -1,60 +0,0 @@
--
:api: get-index
:request: GetIndexRequest
:response: GetIndexResponse
--
[id="{upid}-{api}"]
[[java-rest-high-get-index]]
=== Get Index API
[id="{upid}-{api}-request"]
==== Get Index Request
A +{request}+ requires one or more `index` arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The index whose information we want to retrieve
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-includeDefaults]
--------------------------------------------------
<1> If true, defaults will be returned for settings not explicitly set on the index
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Index Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Retrieve a Map of different types to `MappingMetadata` for `index`.
<2> Retrieve a Map for the properties for document type `doc`.
<3> Get the list of aliases for `index`.
<4> Get the value for the setting string `index.number_of_shards` for `index`. If the setting was not explicitly
specified but was part of the default settings (and includeDefault was `true`) then the default setting would be
retrieved.
<5> Retrieve all settings for `index`.
<6> The `Settings` objects gives more flexibility. Here it is used to extract the setting `index.number_of_shards` as an
integer.
<7> Get the default setting `index.refresh_interval` (if `includeDefault` was set to `true`). If `includeDefault` was set
to `false`, `getIndexResponse.defaultSettings()` will return an empty map.

View file

@ -1,43 +0,0 @@
--
:api: get-index-templates-v2
:request: GetIndexTemplateV2Request
:response: GetIndexTemplatesV2Response
--
[id="{upid}-{api}"]
=== Get Composable Index Templates API
The Get Index Templates API allows to retrieve information about one or more index templates.
[id="{upid}-{api}-request"]
==== Get Composable Index Templates Request
A +{request}+ specifies one, or a wildcard expression of index template names
to get. To return all index templates, omit the name altogether or use a value of `*`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> A single index template name
<2> An index template name using wildcard
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Templates Response
The returned +{response}+ consists a map of index template names and their corresponding configurations.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> A map of matching index templates names and the corresponding configurations

View file

@ -1,51 +0,0 @@
--
:api: get-mappings
:request: GetMappingsRequest
:response: GetMappingsResponse
--
[id="{upid}-{api}"]
=== Get Mappings API
[id="{upid}-{api}-request"]
==== Get Mappings Request
A +{request}+ can have an optional list of indices:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> An empty request that will return all indices
<2> Setting the indices to fetch mapping for
==== Optional arguments
The following arguments can also optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Options for expanding indices names
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Mappings Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Returning all indices' mappings
<2> Retrieving the mappings for a particular index
<3> Getting the mappings as a Java Map

View file

@ -1,67 +0,0 @@
--
:api: get-settings
:request: GetSettingsRequest
:response: GetSettingsResponse
--
[id="{upid}-{api}"]
=== Get Settings API
[id="{upid}-{api}-request"]
==== Get Settings Request
A +{request}+ requires one or more `index` arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The index whose settings we should retrieve
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-names]
--------------------------------------------------
<1> One or more settings that be the only settings retrieved. If unset, all settings will be retrieved
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-include-defaults]
--------------------------------------------------
<1> If true, defaults will be returned for settings not explicitly set on the index
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Settings Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> We can retrieve the setting value for a particular index directly from the response as a string
<2> We can also retrieve the Settings object for a particular index for further examination
<3> The returned Settings object provides convenience methods for non String types
If the `includeDefaults` flag was set to true in the +{request}+ the
behavior of +{response}+ will differ somewhat.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-defaults-response]
--------------------------------------------------
<1> Individual default setting values may be retrieved directly from the +{response}+
<2> We may retrieve a Settings object for an index that contains those settings with default values

View file

@ -1,43 +0,0 @@
--
:api: get-templates
:request: GetIndexTemplatesRequest
:response: GetIndexTemplatesResponse
--
[id="{upid}-{api}"]
=== Get Templates API
The Get Templates API allows to retrieve a list of index templates by name.
[id="{upid}-{api}-request"]
==== Get Index Templates Request
A +{request}+ specifies one or several names of the index templates to get.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> A single index template name
<2> Multiple index template names
<3> An index template name using wildcard
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Templates Response
The returned +{response}+ consists a list of matching index templates.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> A list of matching index templates

View file

@ -1,38 +0,0 @@
--
:api: indices-exists
:request: GetIndexRequest
:response: boolean
--
[id="{upid}-{api}"]
=== Index Exists API
[id="{upid}-{api}-request"]
==== Index Exists Request
The high-level REST client uses a +{request}+ for Index Exists API. The index name (or indices' names) are required.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Index
[[java-rest-high-indices-exists-optional-args]]
==== Optional arguments
Index exists API also accepts following optional arguments, through a +{request}+:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-optionals]
--------------------------------------------------
<1> Whether to return local information or retrieve the state from master node
<2> Return result in a format suitable for humans
<3> Whether to return all default setting for each of the indices
<4> Controls how unavailable indices are resolved and how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Response
The response is a +{response}+ value, indicating whether the index (or indices) exist.

View file

@ -1,70 +0,0 @@
--
:api: open-index
:request: OpenIndexRequest
:response: OpenIndexResponse
--
[id="{upid}-{api}"]
=== Open Index API
[id="{upid}-{api}-request"]
==== Open Index Request
An +{request}+ requires an `index` argument:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The index to open
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-waitForActiveShards]
--------------------------------------------------
<1> The number of active shard copies to wait for before the open index API
returns a response, as an `int`
<2> The number of active shard copies to wait for before the open index API
returns a response, as an `ActiveShardCount`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Open Index Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for
each shard in the index before timing out

View file

@ -1,120 +0,0 @@
--
:api: put-index-template-v2
:request: PutIndexTemplateV2Request
:response: AcknowledgedResponse
--
[id="{upid}-{api}"]
=== Create or update composable index template API
[id="{upid}-{api}-request"]
==== Request
A +{request}+ specifies the `name` of a template and the index template configuration
which consists of the `patterns` that control whether the template should be applied
to the new index, and the optional mappings, settings and aliases configuration.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the template
<2> The index template configuration that specifies the index name patterns this template will match
==== Settings
The settings of the template will be applied to the new index whose name matches the
template's patterns.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-settings]
--------------------------------------------------
<1> Settings for this template
<2> Configure the settings on the template building block
<3> Create the IndexTemplateV2 object that configures the index template to apply the defined template to indices matching the patterns
==== Mappings
The mapping of the template will be applied to the new index whose name matches the
template's patterns.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-mappings-json]
--------------------------------------------------
<1> The mapping, provided as a JSON string
<2> Configure the mapping on the template building block
==== Aliases
The aliases of the template will define aliasing to the index whose name matches the
template's patterns. A placeholder `{index}` can be used in an alias of a template.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-aliases]
--------------------------------------------------
<1> The alias to define
<2> The alias to define with placeholder
<3> Configure the aliases on the template building block
==== Component templates
Component templates can be used as building blocks for specifying mappings, settings or aliases
configurations, but they don't apply to indices themselves. To be applied to an index, the
component templates must be specified in the `componentTemplates` list of the `IndexTemplateV2`
index template definition object. The order in which they are specified in the list is the order
in which the component templates are applied.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-component-template]
--------------------------------------------------
<1> The component template used by this index template
==== Priority
In case multiple templates match an index, the priority of matching templates determines
the index template which will be applied.
Index templates with higher priority "win" over index templates with lower priority.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-priority]
--------------------------------------------------
<1> The priority of the template
==== Version
A template can optionally specify a version number which can be used to simplify template
management by external systems.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-version]
--------------------------------------------------
<1> The version number of the template
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-create]
--------------------------------------------------
<1> To force to only create a new template; do not overwrite the existing template
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request

View file

@ -1,78 +0,0 @@
--
:api: put-mapping
:request: PutMappingRequest
:response: PutMappingResponse
--
[id="{upid}-{api}"]
=== Update mapping API
Adds new fields to an existing data stream or index. You can also use the API to
change the search settings of existing fields.
[id="{upid}-{api}-request"]
==== Request
A +{request}+ requires an `index` argument:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The index to add the mapping to
==== Mapping source
A description of the fields to create on the mapping; if not defined, the mapping will default to empty.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-source]
--------------------------------------------------
<1> Mapping source provided as a `String`
==== Providing the mapping source
The mapping source can be provided in different ways in addition to
the `String` example shown above:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-map]
--------------------------------------------------
<1> Mapping source provided as a `Map` which gets automatically converted
to JSON format
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-xcontent]
--------------------------------------------------
<1> Mapping source provided as an `XContentBuilder` object, the Elasticsearch
built-in helpers to generate JSON content
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index creation as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ allows to retrieve information about the executed
operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request

View file

@ -1,106 +0,0 @@
--
:api: indices-put-settings
:request: UpdateSettingsRequest
:response: UpdateSettingsResponse
--
[id="{upid}-{api}"]
=== Update Indices Settings API
The Update Indices Settings API allows to change specific index level settings.
[id="{upid}-{api}-request"]
==== Update Indices Settings Request
An +{request}+:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Update settings for one index
<2> Update settings for multiple indices
<3> Update settings for all indices
==== Indices Settings
At least one setting to be updated must be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-create-settings]
--------------------------------------------------
<1> Sets the index settings to be applied
==== Providing the Settings
The settings to be applied can be provided in different ways:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-create-settings]
--------------------------------------------------
<1> Creates a setting as `Settings`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-settings-builder]
--------------------------------------------------
<1> Settings provided as `Settings.Builder`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-settings-source]
--------------------------------------------------
<1> Settings provided as `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-settings-map]
--------------------------------------------------
<1> Settings provided as a `Map`
==== Optional Arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-preserveExisting]
--------------------------------------------------
<1> Whether to update existing settings. If set to `true` existing settings
on an index remain unchanged, the default is `false`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the new setting
as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the new setting
as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Update Indices Settings Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request

View file

@ -1,132 +0,0 @@
--
:api: put-template
:request: PutIndexTemplateRequest
:response: PutIndexTemplateResponse
--
[id="{upid}-{api}"]
=== Create or update index template API
[id="{upid}-{api}-request"]
==== Request
A +{request}+ specifies the `name` of a template and `patterns`
which controls whether the template should be applied to the new index.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the template
<2> The patterns of the template
==== Settings
The settings of the template will be applied to the new index whose name matches the
template's patterns.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-settings]
--------------------------------------------------
<1> Settings for this template
[[java-rest-high-put-template-request-mappings]]
==== Mappings
The mapping of the template will be applied to the new index whose name matches the
template's patterns.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-mappings-json]
--------------------------------------------------
<1> The mapping, provided as a JSON string
The mapping source can be provided in different ways in addition to the
`String` example shown above:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-mappings-map]
--------------------------------------------------
<1> Mapping source provided as a `Map` which gets automatically converted
to JSON format
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-mappings-xcontent]
--------------------------------------------------
<1> Mapping source provided as an `XContentBuilder` object, the Elasticsearch
built-in helpers to generate JSON content
==== Aliases
The aliases of the template will define aliasing to the index whose name matches the
template's patterns. A placeholder `{index}` can be used in an alias of a template.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-aliases]
--------------------------------------------------
<1> The alias to define
<2> The alias to define with placeholder
==== Order
In case multiple templates match an index, the orders of matching templates determine
the sequence that settings, mappings, and alias of each matching template is applied.
Templates with lower orders are applied first, and higher orders override them.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-order]
--------------------------------------------------
<1> The order of the template
==== Version
A template can optionally specify a version number which can be used to simplify template
management by external systems.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-version]
--------------------------------------------------
<1> The version number of the template
==== Providing the whole source
The whole source including all of its sections (mappings, settings and aliases)
can also be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-whole-source]
--------------------------------------------------
<1> The source provided as a JSON string. It can also be provided as a `Map`
or an `XContentBuilder`.
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-create]
--------------------------------------------------
<1> To force to only create a new template; do not overwrite the existing template
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request

View file

@ -1,55 +0,0 @@
--
:api: refresh
:request: RefreshRequest
:response: RefreshResponse
--
[id="{upid}-{api}"]
=== Refresh API
[id="{upid}-{api}-request"]
==== Refresh Request
A +{request}+ can be applied to one or more indices, or even on `_all` the indices:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Refresh one index
<2> Refresh multiple indices
<3> Refresh all the indices
==== Optional arguments
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Refresh Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Total number of shards hit by the refresh request
<2> Number of shards where the refresh has succeeded
<3> Number of shards where the refresh has failed
<4> A list of failures if the operation failed on one or more shards
By default, if the indices were not found, an `ElasticsearchException` will be thrown:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-notfound]
--------------------------------------------------
<1> Do something if the indices to be refreshed were not found

View file

@ -1,50 +0,0 @@
--
:api: reload-analyzers
:request: ReloadAnalyzersRequest
:response: ReloadAnalyzersResponse
--
[id="{upid}-{api}"]
=== Reload Search Analyzers API
[id="{upid}-{api}-request"]
==== Reload Search Analyzers Request
An +{request}+ requires an `index` argument:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The index to reload
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Reload Search Analyzers Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Shard statistics. Note that reloading does not happen on each shard of an
index, but once on each node the index has shards on. The reported shard count
can therefore differ from the number of index shards
<2> Reloading details of all indices the request was executed on
<3> Details can be retrieved by index name
<4> The reloaded index name
<5> The nodes the index was reloaded on
<6> The analyzer names that were reloaded

View file

@ -1,98 +0,0 @@
--
:api: rollover-index
:request: RolloverRequest
:response: RolloverResponse
--
[id="{upid}-{api}"]
=== Rollover Index API
[id="{upid}-{api}-request"]
==== Rollover Request
The Rollover Index API requires a +{request}+ instance.
A +{request}+ requires two string arguments at construction time, and
one or more conditions that determine when the index has to be rolled over:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The alias (first argument) that points to the index to rollover, and
the name of the new index in case the rollover operation is performed.
The new index argument is optional, and can be set to null
<2> Condition on the age of the index
<3> Condition on the number of documents in the index
<4> Condition on the size of the index
<5> Condition on the size of the largest primary shard of the index
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-dryRun]
--------------------------------------------------
<1> Whether the rollover should be performed (default) or only simulated
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-waitForActiveShards]
--------------------------------------------------
<1> Sets the number of active shard copies to wait for before the rollover
index API returns a response
<2> Resets the number of active shard copies to wait for to the default value
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-settings]
--------------------------------------------------
<1> Add the settings to apply to the new index, which include the number of
shards to create for it
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-mapping]
--------------------------------------------------
<1> Add the mappings to associate the new index with. See <<java-rest-high-create-index-request-mappings>>
for examples on the different ways to provide mappings
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-alias]
--------------------------------------------------
<1> Add the aliases to associate the new index with
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Rollover Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for
each shard in the index before timing out
<3> The name of the old index, eventually rolled over
<4> The name of the new index
<5> Whether the index has been rolled over
<6> Whether the operation was performed or it was a dry run
<7> The different conditions and whether they were matched or not

View file

@ -1,83 +0,0 @@
--
:api: shrink-index
:request: ResizeRequest
:response: ResizeResponse
--
[id="{upid}-{api}"]
=== Shrink Index API
[id="{upid}-{api}-request"]
==== Resize Request
The Shrink API requires a +{request}+ instance.
A +{request}+ requires two string arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The target index (first argument) to shrink the source index (second argument) into
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-waitForActiveShards]
--------------------------------------------------
<1> The number of active shard copies to wait for before the shrink index API
returns a response, as an `int`
<2> The number of active shard copies to wait for before the shrink index API
returns a response, as an `ActiveShardCount`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-settings]
--------------------------------------------------
<1> The number of shards on the target of the shrink index request
<2> Remove the allocation requirement copied from the source index
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-maxPrimaryShardSize]
--------------------------------------------------
<1> The max primary shard size of the target index
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-aliases]
--------------------------------------------------
<1> The aliases to associate the target index with
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Shrink Index Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for
each shard in the index before timing out

View file

@ -1,39 +0,0 @@
--
:api: simulate-index-template
:request: SimulateIndexTemplateRequest
:response: SimulateIndexTemplateResponse
--
[id="{upid}-{api}"]
=== Simulate Index Template API
[id="{upid}-{api}-request"]
==== Simulate Index Template Request
A +{request}+ specifies the `indexName` to simulate matching against the
templates in the system.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The name of the index
<2> Optionally, defines a new template
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Simulate Index Template Response
The returned +{response}+ includes a resolved `Template` object containing
the resolved settings, mappings and aliases of the index template that matched
and would be applied to the index with the provided name (if any). It will
also return a `Map` of index templates (both legacy and composable) names and their
corresponding index patterns:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Resolved template configuration that would be applied when creating the index with the provided name
<2> Overlapping index templates and their corresponding index patterns

View file

@ -1,80 +0,0 @@
--
:api: split-index
:request: ResizeRequest
:response: ResizeResponse
--
[id="{upid}-{api}"]
=== Split Index API
[id="{upid}-{api}-request"]
==== Resize Request
The Split API requires a +{request}+ instance.
A +{request}+ requires two string arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The target index (first argument) to split the source index (second argument) into
<2> The resize type needs to be set to `SPLIT`
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
<2> Timeout to connect to the master node as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-waitForActiveShards]
--------------------------------------------------
<1> The number of active shard copies to wait for before the split index API
returns a response, as an `int`
<2> The number of active shard copies to wait for before the split index API
returns a response, as an `ActiveShardCount`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-settings]
--------------------------------------------------
<1> The settings to apply to the target index, which include the number of
shards to create for it
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-aliases]
--------------------------------------------------
<1> The aliases to associate the target index with
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Split Index Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for
each shard in the index before timing out

View file

@ -1,41 +0,0 @@
--
:api: templates-exist
:request: IndexTemplatesExistRequest
:response: Boolean
--
[id="{upid}-{api}"]
=== Templates Exist API
[id="{upid}-{api}-request"]
==== Templates Exist Request
The Templates Exist API uses +{request}+ as its request object. One or more
index template names can be provided at construction.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> A single index template name
<2> Multiple index template names
<3> An index template name using wildcard
==== Optional arguments
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-optionals]
--------------------------------------------------
<1> If `true`, reads templates from the node's local cluster state. Otherwise
reads from the cluster state of the elected master node
<2> Timeout to connect to the master node as a `TimeValue`
<3> Timeout to connect to the master node as a `String`
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Response
The response is a +{response}+ value, `true` if any of the request's template
names match existing templates and `false` otherwise

View file

@ -1,64 +0,0 @@
--
:api: unfreeze-index
:request: UnfreezeIndexRequest
:response: UnfreezeIndexResponse
--
[id="{upid}-{api}"]
=== Unfreeze Index API
[id="{upid}-{api}-request"]
==== Unfreeze Index Request
An +{request}+ requires an `index` argument:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The index to unfreeze
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is frozen
as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-waitForActiveShards]
--------------------------------------------------
<1> The number of active shard copies to wait for before the unfreeze index API
returns a response, as an `ActiveShardCount`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Unfreeze Index Response
The returned +{response}+ allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for
each shard in the index before timing out

Some files were not shown because too many files have changed in this diff Show more