Skip to content

Safeguard: limit number of terms in TermsQuery #18829

@jonaf

Description

@jonaf

Describe the feature: I have seen a lot of cases where an application will generate some long list of terms for a TermsQuery and pass it off to Elasticsearch. In general, TermsQuery performance degrades quickly as more terms are added, and once you get into hundreds (or thousands), you can pretty much forget it. (Unless there's a way to do a terms query with hundreds or thousands of terms and I just don't know the secret.) I think we should consider short-circuiting on the number of terms if it goes beyond some threshold unless some overriding argument is given. Additionally, it might be a good idea for Elastic.co documentation to warn users that many terms can have a substantial impact on latency, and of course point out the default limit/safeguard (supposing it is decided that the number of terms should be limited).

Relates #11511

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions