-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Custom analyzer filter scope #20479
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
Comments
@johtani Could you take a look at this please? |
Hi @mbarker Before 2.4, we didn't validate any template on index template creation. @clintongormley Should we support to validate any template with only |
@johtani It seems to me like validating a template should be scoped to the context it should have available during indexing, unless I'm misunderstanding how ES supports multiple templates. We certainly could replicate all of the analyzers/filters to all the templates where they are used, I was trying to avoid duplicating parts of the template. If it would help I can give more details about how we are trying to compose the templates and the rationale behind it. |
Thanks. I will think what the validation is more useful for users. Validating template on index template creation is helpful for many users because users know the error earlier than validating creating index, especially logging use-case. e.g. If there is skip validation flag and simulate template with index name without creating index, is it useful? |
There is something else going on here. I (like @mbarker ) didn't understand why this template succeeded:
while this template didn't:
The reason is that the first analyzer definition is invalid, but is not validated:
You're using the |
I like the idea of a skip evaluation flag. Not sure the simulate bit is needed - easy to test by just creating an index. |
Or elasticsearch can create template always and if a template has some errors elasticsearch only return warning message. what do you think? @clintongormley |
I'm wondering how hard it would be to figure the parent templates of a given template (because the wildcard is more general) and apply them as well at validation time. |
You could always make up name for the index to validate based on the template matching, ie replace The only caveat would be users have to upload templates in dependency order. |
If templates are validated using their dependencies when creating or updating, then what will happen when a template's dependency is deleted or updated? For example template A depends on B:
Heres another thought: what if a template is invalid by itself, but the index is created with explicit settings that the template depends on? Another possible issue: What if a template overrides something in a another template that results in a final mapping that is invalid? |
@qwerty4030 Thanks for your comment! In your 1st case, I think it is OK that elasticsearch does not validate at template deletion time. In your 3rd case, we can validate overriding only the parent templates. I' not sure your 2nd case. Could you explain any examples? |
Just tried this in 2.3.2:
To reproduce:
|
Thanks. I think Elasticsearch should return the error in your cases, because that is tricky settings. |
Apply parent templates at creation time Add some testcases Closes elastic#20479
As I explained in #20919, this is a design error: templates should be validated only as much as any incomplete object can be validated. Elasticsearch shoud reject a template only if it contains plain inconsistencies or grammar violations. On top of that, this is a breaking change which you failed to document! I have a patch that fixes the too hasty conclusion that a referred analyzer should have been declared in the same template. I consider it elegant enough for production, but I didn't bother with updating the tests. |
The code is in this branch. GitHub doesn't let me to submit a pull request against a tag, neither from a particular commit. 👎 |
@acarstoiu you don't seem to get how the open source world works. Frankly, your attitude makes me disinclined to converse with you further. |
@clintongormley you do that, I agree. And by the way, you can find in there lots of deprecations under the "breaking change" label, but when a true one is discovered, you keep it hidden. |
@clintongormley I for one agree with @acarstoiu and frankly, your dismissal of this extremely inconvenient non-documented breaking change that has completely affected our cluster and must now be downgraded across the board is very concerning in the least. You are literally costing us time and money.
You don't seem to understand how businesses work and seem to have very little regard as to the users of your product when you inexplicably hide information and then dismiss users that hit the issue because you don't like their attitude when they're justifiably irritated? Isn't one of the tenets of open source software transparency? If so, you've missed the mark on this one. |
@clintongormley as mentioned in #21105 (comment) I think this should be noted in the 2.4 migration docs as a breaking change. Took us a while to track down this issue while attempting to migrate our 2.3.x cluster. |
@marshall007 Yes I agree - I've just been rather put off working on this issue by the comments of others. If you'd like to submit a PR adding the breaking changes docs, I'd be happy to merge it. |
@clintongormley sure thing! I have it up in PR #21869. |
thanks @marshall007 - merged |
@clintongormley @marshall007 is that PR supposed to update this page? Thanks! |
Thanks @qwerty4030 - that page wasn't being included in the docs. Should be fixed now: https://www.elastic.co/guide/en/elasticsearch/reference/2.4/breaking-changes-2.4.html |
@clintongormley that page still appears to be out of date, FYI. Looks like it hasn't been updated since 537f4e1. |
Closing in favour of #21105 |
Add flag and docs Related elastic#20479
Add else block Related elastic#20479
Fix version issue Related elastic#20479
Elasticsearch version: 2.4.0
Plugins installed: [kopf]
JVM version: 1.8.0_60
OS version: OSX 10.11.6 locally, reproducible on CentOS 7.2.1511 as well
Description of the problem including expected versus actual behavior:
After upgrading to 2.4.0 our templates are no longer functioning from 2.3.3.
We have our template split up into several templates so we can specify default analyzers per language, and we share analyzers/filters/tokenizers between the templates.
Steps to reproduce:
czech
analyzer referencing a filter from theanalyzers
template.analyzers
template.This action fails, resulting in:
However, as you see the first
analyzer-cs
was able to reference themax_length
filter without issue.These templates worked fine in 2.3.3 and 2.3.4, haven't tried 2.3.5 but it sounds like there weren't any changes to that release. Reading over release notes for 2.4.0 don't seem to indicate anything that would prevent this functionality from being supported.
We were seeing similar issues with referencing the shared analyzers in our mapping template file.
Provide logs (if relevant):
The text was updated successfully, but these errors were encountered: