Skip to content

Add search method to high level REST client#24796

Merged
javanna merged 4 commits intoelastic:masterfrom
javanna:enhancement/hl_client_search
May 29, 2017
Merged

Add search method to high level REST client#24796
javanna merged 4 commits intoelastic:masterfrom
javanna:enhancement/hl_client_search

Conversation

@javanna
Copy link
Copy Markdown
Contributor

@javanna javanna commented May 19, 2017

This PR is currently based on #24795 and #24794 . It will go in after them. It is also opened against the feature/client_aggs_parsing as it is based on the work done on the branch, but it will go directly to master once the branch is merged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we should probably introduce some kind of setting in the client that allows to choose whether we should use POST or GET when there's a body.

Copy link
Copy Markdown
Member

@tlrx tlrx left a comment

Choose a reason for hiding this comment

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

LGTM, I left some minor comments

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we renamed it SEARCH_REQUEST_CONTENT_TYPE?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it is supposed to be used in all requests that have a body which we generate calling toXContent. It is not just about search (although it is at the moment)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Then we'll need to add support for scroll search

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Collections.emptySet() is already statically imported so you can use emptySet()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we rename this method to getDefaultNamedXContents()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we could have a method that provides the map of named aggregations and another for the suggestions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be nice to use CompletionSuggestion.NAME etc too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, I wasn't sure, I copied this from SuggestTests :) will change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought about this as well, but why do we need to separate the two?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe set this to frequently()?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we could check that successful == total shards and that total shards is greater than zero

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

because we rely on defaults that may change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes

Copy link
Copy Markdown
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

@javanna I had a first look, left a question about registering the children and matrix-stats parsers and two small nits.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: maybe test with source more often (frequently?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep Tanguy made the same comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How do we register the parset for the "children" aggregation here? After all its in its own module.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same for the "matrix_stats" aggregation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we just don't :) I guess I should add that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll take a look at this - One way is to have a RestHighLevelClient that accepts SearchPlugins and use the getAggregations() getSuggester() specs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added support for children and matrix stats. We will ship with their jar. Plugins will be a different story.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some if these assertions look quiet similar for most test cases here, maybe they can be moved to a single helper method?

@javanna javanna force-pushed the enhancement/hl_client_search branch from 47df9d4 to c7ca3de Compare May 19, 2017 16:17
@javanna javanna changed the base branch from feature/client_aggs_parsing to master May 22, 2017 12:44
javanna added a commit to javanna/elasticsearch that referenced this pull request May 22, 2017
This will be useful for the high level client to add support for the matrix stats aggregation, as we will ship with this jar by default like we do for parent-join-client which is aligned with distributing core with the modules already included.

Relates to elastic#24796
javanna added a commit that referenced this pull request May 23, 2017
This will be useful for the high level client to add support for the matrix stats aggregation, as we will ship with this jar by default like we do for parent-join-client which is aligned with distributing core with the modules already included.

Relates to #24796
javanna added a commit that referenced this pull request May 24, 2017
This will be useful for the high level client to add support for the matrix stats aggregation, as we will ship with this jar by default like we do for parent-join-client which is aligned with distributing core with the modules already included.

Relates to #24796
@javanna javanna force-pushed the enhancement/hl_client_search branch from 729bc7a to 6a25920 Compare May 26, 2017 09:51
@javanna
Copy link
Copy Markdown
Contributor Author

javanna commented May 26, 2017

I addressed comments and added tests for matrix-stats and children aggregation. Can you have another look please?

@javanna javanna merged commit c120f8a into elastic:master May 29, 2017
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request May 29, 2017
* master:
  Add a second refresh to concurrent relocation test
  Add a dummy_index to upgrade tests to ensure we recover fine with replicas (elastic#24937)
  Rework bwc snapshot projects to build up to two bwc versions (elastic#24870)
  Move the IndexDeletionPolicy to be engine internal (elastic#24930)
  [Tests] Harden InternalExtendedStatsTests (elastic#24934)
  TCorrecting api name (elastic#24924)
  Add search method to high level REST client (elastic#24796)
  Add fromXContent method to ClearScrollResponse (elastic#24909)
  ClearScrollRequest to implement ToXContentObject (elastic#24907)
  SearchScrollRequest to implement ToXContentObject (elastic#24906)
  Fix bug in weight computation for query cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants