divyanayan awasthi
divyanayan awasthi

Reputation: 960

elastic search query for String data type

I am trying to a elastic search query on string data type ,but still getting blank response

My query string is like :

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

     ]
    }
  }
}

what am is missing here and how can I search for comma-separated strings

Upvotes: 2

Views: 63

Answers (1)

A l w a y s S u n n y
A l w a y s S u n n y

Reputation: 38552

Simply try with orderGuid.keyword

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

OR with match,

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

Upvotes: 2

Related Questions