I can not understand why not looking ...

Having a list of brands in my hands, I try to find products that have at least one of them.

Elastic version 2.3.2

Write example

{ "_index": "xxx", "_type": "item", "_id": "77a9d1b0-31d8-4426-8751-6e544029031b", "_version": 1, "found": true, "_source": { "item": "Item name", "brands": [ "756ce796-8cb3-4cda-8a0e-3660a56d4928" ], } } 

I'm trying to get all the items with at least one brand from the array with this request

 curl -XGET "http://localhost:9200/xxx/item/_search" -d' { "query": { "bool": { "must": [ { "terms": { "brands": [ "6c28d3fe-c8ab-4aee-88bf-eff7a7acfc6b", "2646f9c7-31a1-4f6b-a039-633fdd9629dfc", "a0bad100-1876-448d-9017-62a015a28d24", "26463bfe-c937-4051-8a0f-2c3e5f025cb2", "756ce796-8cb3-4cda-8a0e-3660a56d4928", "afd76352-ca21-47d5-8236-4fb54cfbf6f8" ] } } ] } } }' 

In the answer finds nothing

  • I understand the tokenizer broke my uuid into 5 words ... - Nietono Shana

1 answer 1

In general, the UUID was broken into 5 words with a dash. What would all become good in the mapping field put down brands: { type: string, index: "not_analyzed" }