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

Add an API for field value suggestions? #59137

Closed
jpountz opened this issue Jul 7, 2020 · 3 comments
Closed

Add an API for field value suggestions? #59137

jpountz opened this issue Jul 7, 2020 · 3 comments
Labels
>feature Initiative:MakeItSlow :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@jpountz
Copy link
Contributor

jpountz commented Jul 7, 2020

Kibana currently powers field value suggestions with aggregations, by enforcing strict timeouts in order to make sure to get suggestions in a timely fashion. Unfortunately, despite great care to make these suggestions cheap, this has been a source of performance/load issues in the past. Upcoming features like searchable snapshots and schema on read are going to make this worse.

With the introduction of constant_keyword and possibly enum, we now have the opportunity to return field suggestions on fields that are mapped with these types without performing any disk I/O. Should we expose this via a new API?

@jpountz jpountz added >feature :Search/Search Search-related issues that do not fall into other categories labels Jul 7, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Search)

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Jul 7, 2020
@romseygeek
Copy link
Contributor

We can also get relatively cheap prefix suggestions directly from the terms dictionaries of keyword fields. I'd suggest a new API that looks something like this:

GET [index-pattern]/_field_values/[field]?size=10
GET [index-pattern]/_field_values/[field]/[prefix]?size=10

For constant_keyword fields we can return immediately from mappings; for keyword we consult the terms dictionary and return the first n matching values. Any other field types return an error, so you can't accidentally hit a source-only field and get a very slow response. We can filter out frozen indices, or maybe return values if we know that the relevant parts of the index have been cached on a node.

In order to keep things fast, we would not support:

  • adding filters to only return values that are definitely included in a result set
  • sorting by anything other than lexicographical value (eg no sorting by frequency or similar)

@markharwood
Copy link
Contributor

for keyword we consult the terms dictionary and return the first n matching values.

I wonder to what extent aesthetics might play a part here and users want New York not new york because the field was normalized. It's a lot of extra work to get that cleaner experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>feature Initiative:MakeItSlow :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

No branches or pull requests

6 participants