簡體   English   中英

如何在彈性搜索中基於關鍵字段進行查詢

[英]how to query based on key field in elastic search

"test": {
           "124": {
                    "folders": [
                                {
                                    "unread_count": 0,
                                    "custom": 0,
                                    "id": 2
                                },
                                {
                                    "unread_count": 1,
                                    "custom": 0,
                                    "default_tag": 1,
                                    "id": 3
                                }
                            ],
                            "scans": [
                                {
                                    "folder_id": 3,
                                    "type": "local",
                                    "uuid": "4cf2531f-0d85-3a47-6262-",
                                    "id": 375
                                }
                                ]
                                
                            }
                    }

查詢以檢查test 和 124 字段是否存在以及“id”:375 是否存在,這是掃描並返回相同的結果。 如果它存在。

我還沒有找到任何基於字段的查詢材料,有沒有什么方法。 嘗試使用must 查詢並存在返回空結果。

我很確定你的數據可以更干凈,但你可以做這樣的事情。 如果您的用例不簡單,您可能會遇到這個問題。

{
  "query": {
    "multi_match" : {
      "query":    375, 
      "fields": [ "test.*.id"] 
    }
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM