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

Throw error when all_fields mode queries over a certain number of fields #25105

Closed
dakrone opened this issue Jun 7, 2017 · 6 comments
Closed
Assignees
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories

Comments

@dakrone
Copy link
Member

dakrone commented Jun 7, 2017

The automatic expansion of fields to query on for the query_string and simple_query_string queries has been found to have some performance issues for users with a large numbers of fields. See: elastic/kibana#12097

Should we limit the number of fields the auto-expansion is limited to, throwing an error if a query searches more than that many fields? If so, what should the limit be? @jimczi mentioned 100 fields in the original issue as perhaps a good starting point.

@dakrone
Copy link
Member Author

dakrone commented Jun 9, 2017

We discussed this, and decided that we should add the same limit that BooleanQuery has to the DisjuntionMaxQuery - that is, a limit of 1024 clauses.

Additionally, we should document that the all_fields mode can be expensive in the case where there are a lot of fields, and that a user should search a subset of fields or use copy_to to create a custom field containing the contents of other fields.

@trevan
Copy link

trevan commented Jun 12, 2017

@dakrone, Could there also be a way to restrict which fields are included in an "all_fields" query? I have over 1400 fields in an index and I've been planning on removing the _all field to reduce memory usage. But this restriction will prevent easily searching without specifying a set of field names. I'd be fine with determining which fields shouldn't be used in "all_fields" to reduce the number below <1024 but I don't want to use copy_to since that is basically the same thing as using the _all field and the memory usage won't be reduced.

@dakrone
Copy link
Member Author

dakrone commented Jun 15, 2017

Could there also be a way to restrict which fields are included in an "all_fields" query?

You could use the multi_match query and specify the fields manually in the request (so like "fields": ["foo.*", "bar," "baz", "eggplant"]) to restrict them, just make sure you set "lenient": true also. Either that, or you could use copy_to to create a custom field that contains only the fields you want it to contain (a custom _all field)

@mr-mos
Copy link

mr-mos commented Jul 21, 2017

@trevan @dakrone I would vote for restricting fields in the "all_query". A multi_match or other queries would expect, that clients know which fields are available and should be searched by default. In many cases this is a configuration on the index and shouldn't be known by the client.
Please check also our current discussion: https://discuss.elastic.co/t/option-for-excluding-fields-in-all-fields-mode-query-for-es-6-0/93218/4
Should I open an issue for this?

@dakrone
Copy link
Member Author

dakrone commented Jul 24, 2017

Should I open an issue for this?

@mr-mos sure, please do open an issue so we can discuss it!

@mr-mos
Copy link

mr-mos commented Jul 28, 2017

@dakrone Opened the issue #25946
(Wasn't able to set any lables?)

dakrone added a commit to dakrone/elasticsearch that referenced this issue Sep 7, 2017
…string

This limits the number of automatically expanded fields for the "all fields"
mode (`"default_field": "*"`) for the `query_string` and `simple_query_string`
queries to 1024 fields.

Resolves elastic#25105
@dakrone dakrone removed the help wanted adoptme label Sep 7, 2017
@dakrone dakrone self-assigned this Sep 7, 2017
dakrone added a commit that referenced this issue Sep 8, 2017
…string (#26541)

* Limit the number of expanded fields it query_string and simple_query_string

This limits the number of automatically expanded fields for the "all fields"
mode (`"default_field": "*"`) for the `query_string` and `simple_query_string`
queries to 1024 fields.

Resolves #25105

* Add blurb about limit to the docs
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Query DSL labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

No branches or pull requests

4 participants