0

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.

3
  • Do you want to convert this query into URI based search ? Commented Aug 23, 2018 at 16:47
  • @TechnocratSid Yes. I want to convert this GET request to URI based search. like server.com/_search....... Commented Aug 23, 2018 at 17:11
  • Check my answer Commented Aug 23, 2018 at 17:25

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

It worked. Thanks a lot! I have searched a lot but somehow I didn't get this doc link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.