We have a JSON document where an attribute ("Names") is an array of
elements in random order and another attribute ("Values") is an array where
the order of elements corresponds to the order of elements in "Names".
To simplify, think about two Arrays (Names and Values), where each index in
Names corresponds to that index in values.
For example:
{
"Names" : [ "A", "B", "X", "C"],
"Values" : [
["Values1 for A", "Value 2 for A"],
["Values1 for B", "Value 2 for B"],
["Values1 for X", "Value 2 for X", "Value 3 for X"],
["Values1 for C", "Value 2 for C"]
]
}
The user wants to query something like "Give me the value for 'X'" which in
the above example should return a collection (["Values1 for X", "Value 2
for X", "Value 3 for X"]).
In code, it's something like -> return Values [ Names.IndexOf( "X" ) ];
Is it possible to write a single query that will find the index from one
array and fetch the value from another in Elastic Search??
Thanks,.
Nick
--