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

Limit the value in prefix query #108486

Open
mayya-sharipova opened this issue May 9, 2024 · 5 comments · May be fixed by #108537
Open

Limit the value in prefix query #108486

mayya-sharipova opened this issue May 9, 2024 · 5 comments · May be fixed by #108537
Labels
>enhancement good first issue low hanging fruit :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@mayya-sharipova
Copy link
Contributor

Description

Prefix queries with a huge values can lead to OOM. Limit the maximum length of the value to be submitted.

@mayya-sharipova mayya-sharipova added >enhancement :Search/Search Search-related issues that do not fall into other categories good first issue low hanging fruit labels May 9, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label May 9, 2024
@elasticsearchmachine
Copy link
Collaborator

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

@lorenzoverardo lorenzoverardo linked a pull request May 12, 2024 that will close this issue
@YahelyUshpiz
Copy link

working on it

@benwtrent
Copy link
Member

We need to determine what a "huge value" means.

Additionally, I am not 100% sure we want to simply disable this for all users. If we blindly reject query prefixes we think are "large", it would break existing behavior (e.g. user's who expect a query to work now has their query always fail with no recourse).

Maybe there should be a setting indicating the allowed prefix size or if "large" prefixes are allowed?

We cannot use the setting search.allow_expensive_queries to indicate if large prefixes are allowed or not, as its already used to determine if prefix queries themselves are allowed.

@mayya-sharipova
Copy link
Contributor Author

mayya-sharipova commented May 13, 2024

It is reasonable to have a limit of 1000.

I suggest we reuse the setting index.max_regex_length and update the documentation saying that this setting also applies to prefix queries (and may be also wildcard queries?).

@benwtrent What do you think?

@benwtrent
Copy link
Member

@mayya-sharipova I think using index.max_regex_length is a good idea. Default of 1k is prudent.

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

Successfully merging a pull request may close this issue.

4 participants