我正在尝试对字符串数据类型进行 flex 搜索查询,但仍然收到空白响应

我的查询字符串是这样的:

GET  orders/_search
{
              "from" : 0,
        "size" : 10000,
      "query":
    { "bool": {"must": [
                     {
          "terms": {
              "orderGuid" : ["98fe6b41-8499-4b85-82f7-f7b18e5da374"]
          }
        }

     ]
    }
  }
}

这里缺少什么,如何搜索逗号分隔的字符串

最佳答案

只需尝试使用orderGuid.keyword

GET orders/_search
{
  "from": 0,
  "size": 100,
  "query": {
    "bool": {
      "must": [
        {
          "terms": {
            "orderGuid.keyword": [
              "98fe6b41-8499-4b85-82f7-f7b18e5da374"
            ]
          }
        }
      ]
    }
  }
}

或者使用match
GET orders/_search
{
  "from": 0,
  "size": 100,
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "orderGuid": "98fe6b41-8499-4b85-82f7-f7b18e5da374"
          }
        }
      ]
    }
  }
}

关于amazon-web-services - Elasticsearch 查询字符串数据类型,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57820335/

10-12 05:00