I created an issue for this and wasn't going to bother the discussion
board, but since I found a workaround I thought I'd mention it here
for the benefit of Google-searchers. Shay, if you don't think it needs
to be in both places, feel free to delete in one of them!
Summary:
In "js" and "mvel", 0.16.2:
1] If you try to treat a single value as an array using
"doc['field'].values", you get an exception (which is annoying because
it includes arrays of size 1, where as a script writer you'd obviously
like to have a single clause to handle all arrays)
2] More importantly, "doc['field'].multiValued" returns true in both
cases, so you cannot distinguish between arrays of size 1 and size >
- For mvel I can't see a workaround. For javascript use "doc['field']
== Array" instead.
Sorry all, I let my optimism get the better of me. The "workaround"
stops it from throwing an exception but only because it always returns
false
The bug is real though....
On Jul 22, 3:57 pm, Alex at Ikanow apigg...@ikanow.com wrote:
I created an issue for this and wasn't going to bother the discussion
board, but since I found a workaround I thought I'd mention it here
for the benefit of Google-searchers. Shay, if you don't think it needs
to be in both places, feel free to delete in one of them!
Scripts: arrays: ".multiValued" returns true even when ".values" fails · Issue #1145 · elastic/elasticsearch · GitHub
Summary:
In "js" and "mvel", 0.16.2:
1] If you try to treat a single value as an array using
"doc['field'].values", you get an exception (which is annoying because
it includes arrays of size 1, where as a script writer you'd obviously
like to have a single clause to handle all arrays)
2] More importantly, "doc['field'].multiValued" returns true in both
cases, so you cannot distinguish between arrays of size 1 and size >
- For mvel I can't see a workaround. For javascript use "doc['field']
== Array" instead.