Elastic search URI search to query object

GET twitter/_search?q="11|2019|myName:user|testname|5b2b18f2-54ab-11ea-a2e3-2e728ce88125|A|M|testuser"

when I run the above query able to get the exact results

even I tried GET twitter/_search?q="11|2019|myName:user|testname|5b2b18f2-54ab-11ea-a2e3-2e728ce88125

able to get all the proper results

if I want to query the same, from query object how can I build the query objecct
note: my Id consists of special characters(example:11|2019|myName:user|testname|5b2b18f2-54ab-11ea-a2e3-2e728ce88125|A|M|testuser)

What is the analyzer used?

this is "_id", we did n't use any custom analyzers on it

Why do you want to search using the _id field?

Why not

GET /twitter/_doc/11|2019|myName:user|testname|5b2b18f2-54ab-11ea-a2e3-2e728ce88125

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

we are using ES client and we want to query with other parameters too

You can do a GET by id with a client as well.
Could you share an example where you are querying both for _id and another field?

Also please share a full example.

{
   "query":{
      "bool":{
         "must":[
            {
               "match":{
                  "status":"inProgress"
               }
            },
            {
               "query_string":{
                  "query":"  (id:*12  AND  \\|  AND  2016 AND \\ |myName \\:user*)   AND   (userRole:*admin*) ",
                  "fields":[
                     "id",
                     "userRole"
                  ]
               }
            }
         ],
         "must_not":[
            {
               "match":{
                  "isDeleted":true
               }
            }
         ]
      }
   }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.