-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Should we rework strict parsing? #19552
Comments
I am afraid that we forgot to migrate |
@javanna should we even have this setting anymore? what does it do? it looks like it was first added here bc5a9ca#diff-bb1674dc350eba2cee9dbef9525e22c5R120 |
It seems to have a number of different uses, some of which should just be defaults (eg queries must end with |
I thought that is the only chance we have to fail requests with deprecated syntax, or at least what |
and the point in favour of renaming it is that we use |
I think we should have some setting that people can set to true in development that fails requests that have deprecated syntax. They can override it on the request level. They can set it to false in production so it never fails anything and they just catch these problems in dev (hopefully). I'd certainly have used it. If this setting, or some version of it is the way to go then great. I'm a bit skeptical because I see us doing stuff like calling I don't know that it is that simple though as part of the problem with deprecated syntax is deprecated mappings and settings. The whole "override on the request" is much harder to do there. |
Somewhat related discussion: #19504 (comment) |
Taking here some of the discussion we are having in #19504 , now that we always return deprecation warnings as response headers I tend to agree that we should consider removing the I am really tempted to just clean stuff up first, then we can see whether we still need strict parsing and how we can implement it differently with the infra that we have now. Maybe we can simply piggy back on the deprecation logger as the central place for doing anything around deprecated syntax. Good news is that it is not such a breaking change given that we never documented the setting, plus users cannot even set the setting I think at the moment :) |
We discussed this in FixItFriday. Everybody agreed that we should remove the Removing the setting would remove the need for A separate discussion will need to happen later on whether we want to introduce a new setting to make a request fail in case deprecated syntax is used. Clients could already implement that based on warning response headers. We have to double check if there are deprecation warnings that don't get returned as response headers but only logged, and what should happen for those if any. |
We return deprecation warnings as response headers, besides logging them. Strict parsing mode stayed around, but was only used in query tests, though we also introduced checks for deprecation warnings there that don't need strict parsing anymore (see elastic#20993). We can then safely remove support for strict parsing mode. The final goal is to remove the ParseFieldMatcher class, but there are many many users of it. This commit prepares the field for the removal, by deprecating ParseFieldMatcher and making it effectively not needed. Strict parsing is removed from ParseFieldMatcher, and strict parsing is replaced in tests where needed with deprecation warnings checks. Note that the setting to enable strict parsing was never ported to the new settings infra hance it cannot be set in production. It is really only used in our own tests. Relates to elastic#19552
We return deprecation warnings as response headers, besides logging them. Strict parsing mode stayed around, but was only used in query tests, though we also introduced checks for deprecation warnings there that don't need strict parsing anymore (see #20993). We can then safely remove support for strict parsing mode. The final goal is to remove the ParseFieldMatcher class, but there are many many users of it. This commit prepares the field for the removal, by deprecating ParseFieldMatcher and making it effectively not needed. Strict parsing is removed from ParseFieldMatcher, and strict parsing is replaced in tests where needed with deprecation warnings checks. Note that the setting to enable strict parsing was never ported to the new settings infra hance it cannot be set in production. It is really only used in our own tests. Relates to #19552
… directly Relates to elastic#19552 Relates to elastic#22130
…Field directly Relates to elastic#19552 Relates to elastic#22130
…Field directly Relates to elastic#19552 Relates to elastic#22130
… directly Relates to elastic#19552 Relates to elastic#22130
…Field directly Relates to elastic#19552 Relates to elastic#22130
…Field directly Relates to elastic#19552 Relates to elastic#22130
… directly Relates to elastic#19552 Relates to elastic#22130
… directly Relates to elastic#19552 Relates to elastic#22130
Hurray! Thanks for all the work @javanna! |
I was looking into failing the build when we accidentally use deprecated syntax in the docs (a fairly annoying problem to users) and I noticed (again) that we have
index.query.parse.strict
. It is supposed to fail any request that uses deprecated syntax. But we don't really test it so far as I can tell. We test the ParseField supports strict matching but not the setting that enables it from the outside.So I played with the setting and I'm pretty sure it doesn't work at all now. At least, not in any way I expect it to work. You can't set the setting in elasticsearch.yaml. You can't set it in index settings. You can't set it on a url. This seems bad.
I'm not really sure what we should do about it too. Personally, I'd love to be able to control the setting on a request level and the cluster level. That'd be super useful in the docs because you could turn it on in elasticsearch.yaml and then fail all the deprecated requests unless they were marked as "deprecated" somehow. No more deprecated syntax sneaking into the docs.
But there is also the index level - we use it for things like "is it ok to use
off
instead offalse
?" Should the setting live at the index level too? If it does does it only affect mappings and settings on that level or does it affect all interactions with the index? What happens if you do a search across multiple indexes that have different values for the setting? This all feels like overkill for this setting.To top it all off the way this setting flows around the code is kind of odd. We have
ParseFieldMatcher
which holds the setting and extracts it from aSettings
instance. We aren't particularly careful with whichSettings
instance we build theParseFieldMatcher
using. Usually it is the global one but because we buildParseFieldMatcher
a ton of times in the code it is difficult to tell for sure.The text was updated successfully, but these errors were encountered: