0
votes

When I run the below Elasticsearch DSL query on Kibana Dev console it returns the result properly and I was trying to run the same through URI based query as HTTP URL its not working. I have tried search on doc and good, not getting the exact way to frame this query as HTTP based GET url.

GET _search
{
  "size": 100,
  "_source": [
    "fieldname1",
    "fieldname2"
  ],
  "query": {
    "bool": {
      "must": {
        "exists": {
          "field": "fieldname2"
        }
      },
      "must_not": {
        "match": {
          "fieldname2": "*IGNORE*"
        }
      }
    }
  }
}

Any hints please.

1
Do you want to convert this query into URI based search ?TechnocratSid
@TechnocratSid Yes. I want to convert this GET request to URI based search. like server.com/_search.......Karthi1234
Check my answerTechnocratSid

1 Answers

1
votes

The above query in URI Search format can be written as:

GET /_search?q=_exists_:fieldname2 AND !fieldname2:"*IGNORE*"&_source=fieldname1,fieldname2&size=100

The parameter q in URI maps to query_string query.