Skip to content
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

[FEATURE] Add cancel_after_time_interval to SearchRequest and MsearchRequest #1116

Closed
dhauverNS opened this issue Jul 30, 2024 · 5 comments · Fixed by #1147
Closed

[FEATURE] Add cancel_after_time_interval to SearchRequest and MsearchRequest #1116

dhauverNS opened this issue Jul 30, 2024 · 5 comments · Fixed by #1147
Labels
enhancement New feature or request

Comments

@dhauverNS
Copy link

Is your feature request related to a problem?

The cancel_after_time_interval parameter does not exist for search and msearch requests in the Java client.

What solution would you like?

Add cancel_after_time_interval to SearchRequest and MsearchRequest in the Java client.

What alternatives have you considered?

I have not found a workaround.

Do you have any additional context?

Being able to use this parameter is especially useful when using an AWS hosted OpenSearch cluster. Because AWS does not provide a way to set the default cancel_after_time_interval setting for a cluster, there doesn't seem to be any other way to ensure that a request which can't be handled in a reasonable time will be cancelled. We have occasionally encountered outages caused by extremely complicated, long-running search requests bogging down the cluster.

This parameter was missing from the OpenSearch Open API spec for years, and was finally added in June 2024:
opensearch-project/opensearch-api-specification#273

I see there is work underway to generate the Java client code from the Open API specification, which hopefully will eventually provide a solution. But it would be very useful to be able to set this parameter in the interim.
#366 is the recently merged PR to which I am referring.

@dhauverNS dhauverNS added enhancement New feature or request untriaged labels Jul 30, 2024
@dblock
Copy link
Member

dblock commented Jul 30, 2024

@Xtansia what are the changes needed in the generator to pick that up? Maybe @dhauverNS can help?

@dblock dblock removed the untriaged label Jul 30, 2024
@Xtansia
Copy link
Collaborator

Xtansia commented Aug 2, 2024

The size and complexity of the SearchRequest & query types means it's non-trivial to do the initial generation of them. If you wanted to really dig into it that'd be amazing, but I wouldn't categorise it as a "good first issue" per se. So in the meantime it is significantly easier to just add the parameter to the two request classes by hand (copying something like the scroll parameter).

urinud pushed a commit to urinud/opensearch-java that referenced this issue Aug 19, 2024
Signed-off-by: uri.nudelman <[email protected]>
opensearch-trigger-bot bot pushed a commit that referenced this issue Aug 21, 2024
* Fixes #1116

Signed-off-by: uri.nudelman <[email protected]>

* Adds MsearchRequest. Fixes SearchRequest.

Signed-off-by: uri.nudelman <[email protected]>

* Update CHANGELOG.md

Signed-off-by: uri.nudelman <[email protected]>

* spotlessJavaCheck

Signed-off-by: uri.nudelman <[email protected]>

* Adds Builder Function method in MSearch

Signed-off-by: uri.nudelman <[email protected]>

---------

Signed-off-by: uri.nudelman <[email protected]>
Co-authored-by: uri.nudelman <[email protected]>
(cherry picked from commit c84ad24)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@chanon-onman
Copy link

I got the same issue, will this be released in the next version?

Xtansia pushed a commit that referenced this issue Aug 21, 2024
* Fixes #1116



* Adds MsearchRequest. Fixes SearchRequest.



* Update CHANGELOG.md



* spotlessJavaCheck



* Adds Builder Function method in MSearch



---------



(cherry picked from commit c84ad24)

Signed-off-by: uri.nudelman <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: uri.nudelman <[email protected]>
@Xtansia
Copy link
Collaborator

Xtansia commented Aug 21, 2024

@chanon-onman A fix was just merged (thanks to @urinud) so should currently be available in 2.14.0-SNAPSHOT, I'll look to do a proper release of 2.14.0 early next week

@Xtansia
Copy link
Collaborator

Xtansia commented Aug 27, 2024

v2.14.0 has been released and includes the fix for this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants