Answer the question
In order to leave comments, you need to log in
How to select an element from elasticsearch that has exactly the same array value?
Suppose the model has a list of fields and one of them is a list of id of some related fields:
{
'name': 'bla-bla',
'field1': 'value1',
'array': [
1, 2, 3, 4
]
}
Answer the question
In order to leave comments, you need to log in
I don't know if it will work in your case, you can put an additional field into the index,
your [1,2,3,4] will be converted, for example, into the string "1-2-3-4". Those. when indexing and querying, we sort and join.
Something like this ( And filter + Term filter ):
curl -XGET 'http://localhost:9200/index_name/type_name/_search?pretty' -d '{
"filter": {
"and": [
{"term": {"field_name": 1}},
{"term": {"field_name": 2}},
{"term": {"field_name": 3}},
{"term": {"field_name": 4}}
]
}
}'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question