yii2 - How to choose from elasticsearch element that exactly matches the value of the array? -
suppose model has list of fields, , 1 of them - id list related fields:
{ 'name': 'bla-bla', 'field1': 'value1', 'array': [ 1, 2, 3, 4 ] }
necessary select records values coincide array transmits set of id, i.e. if give 1, 2, 3, or vice versa 1, 2, 3, 4, 5, row not find, if pass 3, 2, 4, 1 (i.e. order not address), row should found.
you can following using script
:
{ "query": { "match_all": {} }, "filter": { "script": { "script": "_source.array == [1, 2, 3, 4]" } } }
Comments
Post a Comment