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

high level REST client allows for a wrong operation with scroll API #44493

Closed
domer-sz opened this issue Jul 17, 2019 · 8 comments
Closed

high level REST client allows for a wrong operation with scroll API #44493

domer-sz opened this issue Jul 17, 2019 · 8 comments
Labels
>bug good first issue low hanging fruit

Comments

@domer-sz
Copy link

Feature request -->
High level REST client allows you to set the .from option in SearchSourceBuilder when using SearchScrollRequest but that return ActionRequestValidationException on runtime. The feature request is an api fix so that it does not allow to build a query that will not pass the validation in the runtime.

Example of code that throw ActionRequestValidationException

        final Scroll scroll = new Scroll(TimeValue.timeValueMinutes(1L));
        SearchRequest scrollSearchRequest = new SearchRequest("xxx_listing_read");
        SearchSourceBuilder scrollSearchSourceBuilder = new SearchSourceBuilder();

        BoolQueryBuilder queryBuilder = boolQuery();

        scrollSearchSourceBuilder
            .query(queryBuilder)
            .from(offset)
            .size(perPage);

        scrollSearchRequest.source(scrollSearchSourceBuilder);
        scrollSearchRequest.scroll(scroll);
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@hub-cap hub-cap added >bug good first issue low hanging fruit labels Aug 13, 2019
@9deniz
Copy link
Contributor

9deniz commented Aug 15, 2019

Hi guys, I would like to tackle this one as my first contribution to ES. I assume it is ready to be fixed, right? Or do I need to wait for some clarifications from core team?
Update:
@hub-cap according to this test throwing ActionRequestValidationException is expected.

@hub-cap
Copy link
Contributor

hub-cap commented Aug 23, 2019

You are correct @9deniz , as per 4ff12c9, this is not possible. Maybe @cbuescher can shed some light here if more questions are had by @domer-sz on the subject.

Also, thank you for helping triage this @9deniz, I totally missed that this is the case when I read over it!

@domer-sz
Copy link
Author

Hey, I understand the exception is expected in this situation. The purpose of my request was to make sure you can't design an api in such a way that you can't create a request that won't be executed correctly in runtime.

@hub-cap hub-cap added :Search/Search Search-related issues that do not fall into other categories and removed :Core/Features/Java High Level REST Client labels Aug 28, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@hub-cap
Copy link
Contributor

hub-cap commented Aug 28, 2019

@domer-sz ok thats perfectly acceptable. I will relabel it so it does not pertain to the high level rest client, and instead let the proper people know. Ill also edit the issue a bit so its more descriptive to search

@hub-cap
Copy link
Contributor

hub-cap commented Aug 28, 2019

Actually I misread your point at first, ill remove the search label :) Let me see if its possible to do that with this API currently, since its a generic API that many things can be added to.

@hub-cap hub-cap added :Core/Features/Java High Level REST Client and removed :Search/Search Search-related issues that do not fall into other categories labels Aug 28, 2019
hub-cap added a commit to hub-cap/elasticsearch that referenced this issue Aug 28, 2019
This commit builds on elastic#26235, and adds the same validation to the
builder so that it will throw an exception when setting a scroll on a
request that has from set.

Relates elastic#9373
Closes elastic#44493
@cbuescher cbuescher assigned cbuescher and unassigned cbuescher Sep 2, 2019
@hub-cap
Copy link
Contributor

hub-cap commented Sep 3, 2019

We have decided to close this issue for now without merging and will revisit it once the high level rest client has its own pojos and builders. This is something we will be doing down the road, but we dont have a timeframe on when it will be finished.

@hub-cap hub-cap closed this as completed Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug good first issue low hanging fruit
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants