Hi,
I am looking for an efficient way to compare the items of list.
PUT list_demo/doc/1
{
"items": [1, 2, 3]
}
GET list_demo/_search
{
"query": {
"script": {
"script": {
"source": "(doc['items'].equals(params.items))",
"params": {
"items": [
1,
2,
3
]
}
}
}
}
}
This query has no results.
It seems that doc['items']
is a list of Longs (even if mapped to integer) and params.items
is an ArrayList containing Integers.
I was considering using the hashCode() method to compare both lists. This seems to find equal results, but does it guarantee to not return any false positives?
Are there any other ways to solve this?
I don't speak Java.
Thx in advance