-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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 "all fields" execution mode to simple_query_string query #21341
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left two minors, LGTM otherwise
SearchResponse resp = client().prepareSearch("test").setQuery( | ||
simpleQueryStringQuery("127.0.0.2 \"2015/09/02\"") | ||
.field("f_ip") // Usually this would mean we wouldn't search "all" fields | ||
.useAllFields(true)) // ... unless explicitly requested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just throw an exception in that case (like fields
does) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I actually missed this and the exception throwing was only validating the xcontent parsing, so things like the transport client weren't tripping it. I've changed that to validate it always.
// suggest doesn't match | ||
// geo_point doesn't match | ||
// geo_shape doesn't match | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll want to have a test mixing numbers and text ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I've added another test for mixing the types (other tests in the suite do this as well)
The fact that we need to implement this feature on multiple query parsers makes me wonder whether this could be done at the mapping level, ie the |
@jpountz i thought of something similar, but do we really want this mode to be used in (eg) term queries? |
@jpountz when I talked to Clint about it (basically creating a "meta-field"), I think the |
Good question. We already do something similar with the
Fair enough, I just wanted to make sure we considered this option. |
retest this please |
1 similar comment
retest this please |
retest this please but don't fail pulling the builds this time :-/ |
34806a7
to
a1b6bb5
Compare
This commit introduces a new execution mode for the `simple_query_string` query, which is intended down the road to be a replacement for the current _all field. It now does auto-field-expansion and auto-leniency when the following criteria are ALL met: The _all field is disabled No default_field has been set in the index settings No fields are specified in the request Additionally, a user can force the "all-like" execution by setting the all_fields parameter to true. When executing in all field mode, the `simple_query_string` query will look at all the fields in the mapping that are not metafields and can be searched, and automatically expand the list of fields that are going to be queried. Relates to elastic#20925, which is the `query_string` version of this work. This is basically the same behavior, but for the `simple_query_string` query. Relates to elastic#19784
a1b6bb5
to
7420fd0
Compare
As part of elastic#20925 and elastic#21341 we added an "all-fields" mode to the `query_string` and `simple_query_string`. This would expand the query to all fields and automatically set `lenient` to true. However, we should still allow a user to override the `lenient` flag to whichever value they desire, should they add it in the request. This commit does that.
This change disables the _all meta field by default. Now that we have the "all-fields" method of query execution, we can save both indexing time and disk space by disabling it. _all can no longer be configured for indices created after 6.0. Relates to elastic#20925 and elastic#21341 Resolves elastic#19784
This commit introduces a new execution mode for the
simple_query_string
query, which is intended down the road to be areplacement for the current _all field.
It now does auto-field-expansion and auto-leniency when the following criteria
are ALL met:
Additionally, a user can force the "all-like" execution by setting the
all_fields parameter to true.
When executing in all field mode, the
simple_query_string
query willlook at all the fields in the mapping that are not metafields and can be
searched, and automatically expand the list of fields that are going to
be queried.
Relates to #20925, which is the
query_string
version of this work.This is basically the same behavior, but for the
simple_query_string
query.
Relates to #19784