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

Use new terms enum API for autocomplete value suggestions #100174

Merged
merged 21 commits into from
Jun 29, 2021

Conversation

lukasolson
Copy link
Member

@lukasolson lukasolson commented May 14, 2021

Summary

Requires #100586.
Resolves #92783.
Resolves #97512.

Uses the new terms enum API for a faster autocomplete experience.

Note that currently, the autocomplete only targets warm and hot data tiers. By default, indices are given data_content tier, so to update this, you need to do something like this:

PUT /my-index-*/_settings
{
  "index.routing.allocation.include._tier_preference": "data_hot"
}

To do

  • Config for timeout, data tiers, A/B testing?
  • Update unit/functional tests

Checklist

  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list

Release note

Value suggestions for KQL autocomplete and creating filters now use the Elasticsearch _terms_enum API for improved performance.

@lukasolson lukasolson added release_note:enhancement WIP Work in progress Feature:Filters Feature:KQL KQL v8.0.0 Team:AppServices v7.14.0 auto-backport Deprecated - use backport:version if exact versions are needed labels May 14, 2021
@markharwood
Copy link
Contributor

Note that currently, the autocomplete only targets warm and hot data tiers.

A heads up on how the API evolved - rather than hard-coding that tier filtering logic into the terms_enum API we changed that and made filtering a responsibility of the calling client. The client should filter indices by using a query on the new _tier metadata field so a typical Kibana query would look like:

localhost:9200/myindex/_terms_enum
{
    "field" : "myfield",
    "string" : "Microsof",
    "index_filter": {
        "bool":{
            "must":[
               { "range": "my Kibana time-picker range"},
               { "terms": {"_tier": ["data_warm", "data_hot"]}
             ]
        }
    }
}

Note that the queries used above are a rough filter on whole indices and not individual documents when it comes to where we look for term suggestions (i.e. we might suggest terms originating from docs outside of the provided date range if the docs sit in an index whose time span partially matches the index filter).

@lukasolson
Copy link
Member Author

A heads up on how the API evolved - rather than hard-coding that tier filtering logic into the terms_enum API we changed that and made filtering a responsibility of the calling client. The client should filter indices by using a query on the new _tier metadata field so a typical Kibana query would look like:

@markharwood I've added it as a kibana.yml setting and defaulted it to ["data_hot", "data_warm"]. Does this seem like a reasonable default, or should we include data_content (since nodes default to that tier)?

@markharwood
Copy link
Contributor

defaulted it to ["data_hot", "data_warm"]. Does this seem like a reasonable default, or should we include data_content (since nodes default to that tier)?

adding data_content sounds like it would make sense, covering those indices that don't "age out". Can you confirm @jimczi ?

@jimczi
Copy link

jimczi commented Jun 2, 2021

+1 to add data_content by default. I also wonder if data_cold should be considered. Are we applying the active date range filter on every request ? If so, then it would be nice to consider data_cold as default too since most of the requests to that tier would be filtered by the range. We have the data locally in that tier so I think it makes sense to provide suggestions as long as we can filtered the amount of queries that we need to handle (with the active range filter).

@lukasolson lukasolson marked this pull request as ready for review June 2, 2021 20:19
@lukasolson lukasolson requested a review from a team as a code owner June 2, 2021 20:19
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@lukasolson lukasolson requested a review from lizozom June 10, 2021 16:17
@Dosant
Copy link
Contributor

Dosant commented Jun 23, 2021

@lukasolson, afaik it is not necessary to update api_docs as part of the pr.

@lukasolson lukasolson requested a review from a team as a code owner June 23, 2021 16:38
Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

maps changes LGTM
code review

@lukasolson lukasolson requested a review from Dosant June 24, 2021 06:31
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@mattkime mattkime left a comment

Choose a reason for hiding this comment

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

code change look good, work well!

@lukasolson lukasolson merged commit ebf9e5d into elastic:master Jun 29, 2021
@lukasolson lukasolson removed the WIP Work in progress label Jun 29, 2021
@kibanamachine
Copy link
Contributor

💔 Backport failed

Status Branch Result
7.x Commit could not be cherrypicked due to conflicts

To backport manually run:
node scripts/backport --pr 100174

lukasolson added a commit to lukasolson/kibana that referenced this pull request Jun 29, 2021
…0174)

* Migrate kibana.autocomplete config to data plugin

* Fix CI

* Fix tests

* Use new terms enum API for autocomplete value suggestions

* Add tiers to config

* Re-introduce terms agg and add config/tests for swapping algorithms

* Add data_content and data_cold tiers by default

* Fix types

* Fix maps test

* Update tests

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	src/plugins/data/server/autocomplete/value_suggestions_route.ts
lukasolson added a commit that referenced this pull request Jun 30, 2021
…103798)

* Migrate kibana.autocomplete config to data plugin

* Fix CI

* Fix tests

* Use new terms enum API for autocomplete value suggestions

* Add tiers to config

* Re-introduce terms agg and add config/tests for swapping algorithms

* Add data_content and data_cold tiers by default

* Fix types

* Fix maps test

* Update tests

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	src/plugins/data/server/autocomplete/value_suggestions_route.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Filters Feature:KQL KQL release_note:enhancement v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter value suggestions takes long time to load [Autocomplete] Integrate new autocomplete API
8 participants