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
Failure to create Filtered Alias on empty index with template mappings #10038
Comments
+1. I have the exact same problem. I have more details here: |
Templates per se are fine, this happens because the There are a couple of workarounds for this: index a dummy document that contains the field that you want to filter on before you create the alias, or replace the This is unfortunate, but I tend not to see it as a bug. Thoughts? |
Hi, Yeah, I did that workaround when I encountered this issue, and it's no problem, at least not for us. But the documentation should then maybe clarify this explicitly, especially since this is a change in behaviour from 1.3.x, since I think a lot of people, including myself, thought that the |
I would like to add here that even if _default is not considered an actual mapping and is applied when a document is indexed/a new mapping is explicitly put, it would still make sense for a filtered alias to also be able to look up the same mapping from _default, especially when in most cases you create a filtered alias when you already know your data (just like you put mappings in _default because you already know your data and thus some default mapping). From my perspective, they both kind of go hand in hand. For both filtered alias & _default, you know your mappings (and filter in case of filtered alias) and that's why you want to define them BEFORE indexing any data. The workaround is tested and is working, but it'd be good to have an actual fix and/or change in documentation. |
@shivangshah it's subtle, but the |
@javanna Actually yes. I see your point now. A pre-defined filtered alias would be a problem if the concrete mapping of a specific type is different than the default. |
I am marking this issue for discussion. I do see your point @shivangshah , I am just not sure how we can get there. The feature you are requesting turns around the |
@javanna Btw, what changed in 1.4 that changed this, since it worked in 1.3 ? |
Good question @andersosthus ! Nothing changed around the default mappings. We made alias filters parsing stricter, have a look at #6664 . The reason for it is that you really want to make sure that the the alias filter gets properly parsed based on the mapped data type. |
Ok, thanks @javanna. That explains why this "worked" in 1.3 :) |
@javanna : How about make it more of a configurable flag just like many other configurations handled by the clients ? |
I don't think this can be just a flag since it's a completely different feature compared to the current behaviour... |
Given the work happening in #8871 to have fields of the same name in different types always have the same mapping, perhaps this is something we can support after all? |
yea, good point @clintongormley that makes sense. Or if we go for parsing filters at search time instead, we could turn off strict query parsing I believe: #10135 (comment) . |
we now have an issue for parsing filters at search time, see #10485. |
Alias filters are now parsed at search time, so this works again |
Hi,
ES 1.4.x gives the error
[repro] Strict field resolution and no field mapping can be found for the field with name [testfield]
when I try to create an alias on an empty Index that has template mappings.This works fine in ES 1.3.x.
I see in the guide (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html#filtered) that in 1.4.0.beta1 there was added a clause stating that the field has to exist in the mapping, but it does not mention anything about mapping in templates - so I'm not sure if this is a documentation bug or and ES bug.
Repro case:
The text was updated successfully, but these errors were encountered: