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

Added HLRC support for PinnedQueryBuilder #45779

Merged
merged 2 commits into from
Aug 22, 2019

Conversation

markharwood
Copy link
Contributor

Added new PinnedQueryBuilder in xpack core and related test in SearchIT

Related #44074

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

Copy link
Contributor

@hub-cap hub-cap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from where it should live, but I dont know much about the internals of Pinned Queries so i cant speak to that

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you put the query builder in xpack-core you could probably have a base class that you extend in the business-rules module to provide the toQuery implementation ? This would avoid the serialization duplication ? I also wonder if we should have a note in the HRLC documentation to mention that xpack-core is needed to build PinnedQuery ?

@markharwood
Copy link
Contributor Author

you could probably have a base class that you extend in the business-rules module to provide the toQuery implementation ?

That was something I coded up in my original PR for PinnedQuery but we concluded subclassing was not the way forward

I also wonder if we should have a note in the HRLC documentation to mention that xpack-core is needed to build PinnedQuery ?

In this PR or proposing a different PR that describes HLRC dependencies more generally?

@jimczi
Copy link
Contributor

jimczi commented Aug 21, 2019

That was something I coded up in my original PR for PinnedQuery but we concluded subclassing was not the way forward

I thought it was because we wanted to put the base class in hlrc which would be weird since in this case the xpack module would need to add a dependency on the client. In this pr the class is in xpack core so it feels more natural since the business rules module already have a dependency on xpack-core. I don't have strong feelings about this though so feel free to ignore if you think that it's not a good option.

In this PR or proposing a different PR that describes HLRC dependencies more generally?

I think we can add a small sentence in the query builders docs explaining how to use this extra query. We can revisit this section later as we add more queries there ?

@markharwood
Copy link
Contributor Author

I thought it was because we wanted to put the base class in hlrc which would be weird

If I understand @javanna 's explanation correctly I think it was more about allowing some divergence in class versions used between client and server to allow for less brittle dependencies.

We can revisit this section later as we add more queries there ?

OK

@markharwood
Copy link
Contributor Author

Good to go, Jim?

@javanna
Copy link
Member

javanna commented Aug 22, 2019

My main concern was that server should not depend on HLRC like it was initially proposed. If the base class is in x-pack-core, or any library shared between client and server, I am fine with that. Generally though, we have found that server needs one side (parse requests, print out responses) while client needs the other side (print out requests, parse back responses). Is the doXContent method needed in the server-side code? That is the only duplicated bit at the moment?

@markharwood
Copy link
Contributor Author

Is the doXContent method needed in the server-side code?

Unfortunately I think the test infrastructure in AbstractQueryTestCase assumes the QueryBuilder class under test is multi-purpose and can round-trip all the various ways - to/from xcontent and stream input. I'm having a hard time figuring out how to satisfy all the various compiler and test constraints again that allowed me to subclass.

@javanna
Copy link
Member

javanna commented Aug 22, 2019

I don't think it's a big deal if doXContent is the only duplicated method, maybe leave a comment that it's duplicated for tests only? I wonder if subclassing is worth it then, probably not?

@markharwood
Copy link
Contributor Author

I wonder if subclassing is worth it then, probably not?

I'm not sure it is. The criteria isn't complex - an array of IDs and another QueryBuilder.

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@markharwood markharwood merged commit d1e00e3 into elastic:master Aug 22, 2019
markharwood added a commit to markharwood/elasticsearch that referenced this pull request Aug 22, 2019
* Added HLRC support for PinnedQueryBuilder

Related  elastic#44074
markharwood added a commit that referenced this pull request Aug 23, 2019
Added HLRC support for PinnedQueryBuilder

Related  #44074
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search Relevance/Ranking Scoring, rescoring, rank evaluation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants