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

Allow non-exact query types on the root JSON field. #41290

Merged

Conversation

jtibshirani
Copy link
Contributor

In an earlier iteration of the design, it made sense to disallow these query
types on the root JSON field. It should now it be fine to allow them.

@jtibshirani jtibshirani added >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types labels Apr 17, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

LGTM for the root field, I wonder if you plan to add the support for the keyed field as well, I am fine if we do this in a follow up but I think we can support these queries for both (the root and the keyed field) ?

throw new UnsupportedOperationException("[fuzzy] queries are not currently supported on [" +
CONTENT_TYPE + "] fields.");
throw new UnsupportedOperationException("[fuzzy] queries are not currently supported on keyed " +
"[" + CONTENT_TYPE + "] fields.");
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what is your plan on this but it should be possible to allow this type of query by adding the field prefix in the fuzzy query and change the prefixLength to be prefixLength + field.length + 1 ?

throw new UnsupportedOperationException("[regexp] queries are not currently supported on [" +
CONTENT_TYPE + "] fields.");
throw new UnsupportedOperationException("[regexp] queries are not currently supported on keyed " +
"[" + CONTENT_TYPE + "] fields.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, just adding the field prefix should work ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think it'd make sense to automatically adjust maxDeterminizedStates as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

let's keep the value as is, the field name shouldn't consume a lot of states and the current limit is already high (10,000).

throw new UnsupportedOperationException("[wildcard] queries are not currently supported on [" +
CONTENT_TYPE + "] fields.");
throw new UnsupportedOperationException("[wildcard] queries are not currently supported on keyed " +
"[" + CONTENT_TYPE + "] fields.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here ?

@jtibshirani
Copy link
Contributor Author

I was planning some future work to support these queries on the keyed field. However maybe it's not as difficult as I thought and I could just add it to this PR. The only slight difficulty I saw was that the keys are allowed to contain characters such as *, so they will need to be escaped before being used in wildcard or regex queries.

@jimczi
Copy link
Contributor

jimczi commented Apr 17, 2019

I was planning some future work to support these queries on the keyed field. However maybe it's not as difficult as I thought and I could just add it to this PR.

Thanks, I missed the escaping part. I am fine either way but feel free to merge this pr and we can have a follow up to discuss the keyed field part.

@jtibshirani
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/2

@jtibshirani
Copy link
Contributor Author

Thanks @jimczi, I've decided to merge this as-is.

@jtibshirani jtibshirani merged commit 76fe2e7 into elastic:object-fields Apr 17, 2019
@jtibshirani jtibshirani deleted the json-fields-query-types branch April 17, 2019 22:48
jtibshirani added a commit that referenced this pull request May 1, 2019
In an earlier iteration of the design, it made sense to disallow these query
types on the root JSON field. It should now it be fine to allow them.
jtibshirani added a commit that referenced this pull request May 24, 2019
In an earlier iteration of the design, it made sense to disallow these query
types on the root JSON field. It should now it be fine to allow them.
jtibshirani added a commit that referenced this pull request May 29, 2019
In an earlier iteration of the design, it made sense to disallow these query
types on the root JSON field. It should now it be fine to allow them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants