Skip to content

Conversation

javanna
Copy link
Member

@javanna javanna commented Oct 30, 2015

Similarly to what we did with the search api and the explain api we can now also move query parsing on the coordinating node for the validate query api. This makes it more realistic as query parsing happens now in the coordinating node rather than on the data nodes.

As a result, the java api only accepts the query in QueryBuilder format rather than String or bytes array. This is because the java api works now only with query objects that are already parsed. Note that if a query needs to be provided in string format through the java api this can be done using WrapperQueryBuilder but in that case the parsing of the wrapped query will happen on each data node instead.

The response body returned in case the query parsing phase fails is slightly different compared to before: it will not contain any reference to an index nor shards header, as parsing is now independent from indices/shards.

@javanna javanna changed the title Validate query api: move query parsing on the coordinating node Validate query api: move query parsing to the coordinating node Oct 31, 2015
@javanna
Copy link
Member Author

javanna commented Nov 2, 2015

@s1monw can you have a look please?

@s1monw
Copy link
Contributor

s1monw commented Nov 2, 2015

LGTM

 Similarly to what we did with the search api, we can now also move query parsing on the coordinating node for the validate query api. Given that the explain api is a single shard operation (compared to search which is instead a broadcast operation), this doesn't change a lot in how the api works internally. The main benefit is that we can simplify the java api by requiring a structured query object to be provided rather than a bytes array that will get parsed on the data node. Previously if you specified a QueryBuilder it would be serialized in json format and would get reparsed on the data node, while now it doesn't go through parsing anymore (as expected), given that after the query-refactoring we are able to properly stream queries natively. Note that the WrapperQueryBuilder can be used from the java api to provide a query as a string, in that case the actual parsing of the inner query will happen on the data node.

Relates to elastic#10217
Closes elastic#14384
@javanna javanna force-pushed the enhancement/validate_query_refactoring branch from 30f463b to b56bbf6 Compare November 2, 2015 10:22
@javanna javanna merged commit b56bbf6 into elastic:master Nov 2, 2015
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Search Refactoring labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking-java :Search/Search Search-related issues that do not fall into other categories v5.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants