Unfortunatelly, terms are different on each query.
Also, my solution doesn't work, because for some term's list i get
exception:
nested: ClassCastException[org.elasticsearch.common.mvel2.util.FastList
cannot be cast to java.util.ArrayList
This one will throw exception:
"script": "term in ['3669', '3670', '3676', '3677', '3688', '3712',
'3739', '3748', '3749']"
but this one not:
"script": "term in ['3669', '3670', '3676', '3677', '3688', '3712',
'3739', '3748']"
I had no idea what was going on (array length is not an issue), so I've
changed script to:
"script": "term == 5823 || term == 5824 || ..."
On 07.01.2012 20:43, Shay Banon wrote:
I suggest passing the list of terms as a parameter to the script, so
it won't be compiled each time.
On Sat, Jan 7, 2012 at 12:37 PM, Tomasz Kloc <tomek.kloc.iit@gmail.com
mailto:tomek.kloc.iit@gmail.com> wrote:
Nevermind. I've succeed with: "script": "[9560, 9561].contains(term)"
hi,
I have a filtered query with facet. I want to get facets only
for explicit terms and avoid using size: X or all_terms (and
filtering facets on application side).
i've succeed to do that with 'script':
{'facets': {'category_ids': {'terms': {'field': 'category_ids',
'script': 'term == 9560'}}}}
the only thing i can't figure out is how to write mvel's
script which checks if *term* is in some list/array. Python
example:
term in [1,2,3]
i've also tried to use python syntax adding 'lang' parameter
with values 'python'/'lang-python', but query failed with
exception:
ElasticSearchIllegalArgumentException[script_lang not
supported [lang-python]]
or
ElasticSearchIllegalArgumentException[script_lang not
supported [python]]
any suggestions?