-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Refresh API for RestHighLevelClient #27799
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e8efd85
Add Refresh API for RestHighLevelClient
PnPie 6613822
Merge branch 'master' into rest_highlevel_client_refresh
javanna 77da3d5
changes
PnPie 1753a33
update
PnPie 90756b9
Merge branch 'master' of github.com:elastic/elasticsearch into rest_h…
PnPie a7cbc48
fix conflicts
PnPie 1e7c019
update
PnPie 18086a3
shardId can be null, shardId().getId() may throw NPE.
javanna ed89a7a
update
PnPie 8ee43f8
Merge branch 'master' into rest_highlevel_client_refresh
javanna 7581273
add refresh page
javanna 0168ed5
update
PnPie 7d4ec22
update
PnPie fa9cf77
update
PnPie 9c03b74
small changes
PnPie 9fc4529
reformat code
PnPie 364de26
address last tiny bits
javanna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
[[java-rest-high-refresh]] | ||
=== Refresh API | ||
|
||
[[java-rest-high-refresh-request]] | ||
==== Refresh Request | ||
|
||
A `RefreshRequest` can be applied to one or more indices, or even on `_all` the indices: | ||
|
||
["source","java",subs="attributes,callouts,macros"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[refresh-request] | ||
-------------------------------------------------- | ||
<1> Refresh one index | ||
<2> Refresh multiple indices | ||
<3> Refresh all the indices | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you please the optional arguments section like we have in other places and mention the indices options (ignore_unavailable, allow_no_indices and expand_wildcards)? |
||
==== Optional arguments | ||
|
||
["source","java",subs="attributes,callouts,macros"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[refresh-request-indicesOptions] | ||
-------------------------------------------------- | ||
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and | ||
how wildcard expressions are expanded | ||
|
||
[[java-rest-high-refresh-sync]] | ||
==== Synchronous Execution | ||
|
||
["source","java",subs="attributes,callouts,macros"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[refresh-execute] | ||
-------------------------------------------------- | ||
|
||
[[java-rest-high-refresh-async]] | ||
==== Asynchronous Execution | ||
|
||
The asynchronous execution of a refresh request requires both the `RefreshRequest` | ||
instance and an `ActionListener` instance to be passed to the asynchronous | ||
method: | ||
|
||
["source","java",subs="attributes,callouts,macros"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[refresh-execute-async] | ||
-------------------------------------------------- | ||
<1> The `RefreshRequest` 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 `RefreshResponse` looks like: | ||
|
||
["source","java",subs="attributes,callouts,macros"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[refresh-execute-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 | ||
|
||
[[java-rest-high-refresh-response]] | ||
==== Refresh Response | ||
|
||
The returned `RefreshResponse` allows to retrieve information about the | ||
executed operation as follows: | ||
|
||
["source","java",subs="attributes,callouts,macros"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[refresh-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}/IndicesClientDocumentationIT.java[refresh-notfound] | ||
-------------------------------------------------- | ||
<1> Do something if the indices to be refreshed were not found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to also take the indices options from the refresh request and set them as parameters. See
Params#withIndicesOptions