Hi, we are upgrading our elasticsearch from 1.7.5 to 2.3. There is one case in our mapping seems having problem to reproduce the same query behavior in 1.7:
Previously, we allow users to query fields on "aaa.b1", "aaa.b2", and just "aaa" field for either b1 or b2 by combining "path": "just_name" and "index_name": "aaa" in the mapping. However, now with copy_to, we cannot index values from aaa.b1, and aaa.b2 collectively to just "aaa" as "aaa" is now defined as an object field.
I would like our users can query on “response” field for either value1 or value2. I know I can do response.all as the copy_to field, but query on “response” field is more natural to our users, as it follows an ontology we are using, and users have an expectation to query on response field. I also cannot construct the data as
Note: please use </> when posting code. I updated your answer.
Well. Yes... So I don't see any other solution than reworking your json content.
Not sure if in your ingestion pipeline you can mutate some fields and for example instead of indexing:
{
"foo": {
"a": "bar",
"b": "baz"
}
index
{
"fake_foo": {
"a": "bar",
"b": "baz"
}
And then use copy_to to copy fake_foo.a and fake_foo.b to foo?
Potentially use the same copy_to feature to copy fake_foo.a to foo.a and fake_foo.b to foo.b?
Then don't index fake_*.
Thanks! For now I think I can ask users to query as "aaa.*:value1", instead of previous "aaa:value1". Changing the json structure is not ideal, as this structure is relatively fixed.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.