Skip to content

Elastic Queries in Postman

Brian edited this page Jun 29, 2021 · 2 revisions

New Workspace - HTTP Request

GET request URL LOCAL: http://localhost:9200/studies_development/_search STAGING: http://staging.clinwiki.org:9200/studies_production/_search

Auth Tab - Choose Basic Auth from dropdown, add elastic username and password

Headers Tab - Key: Content-Type Value: application/json

Body - Choose raw from dropdown and JSON from second dropdown - This is where query can be sent, for example:

{
   "query":{

      "bool":{
         "must":[
            {
               "simple_query_string":{
                  "query":"*"
               }
            }
         ]
      }
   },
   "from":0,
   "size":100,
   "aggs":{
      "fm_Brain Tumor Status":{
         "terms":{
            "field":"fm_Brain Tumor Status",
            "size":1000000,
            "missing":"-99999999999",
            "include":"Metastatic|Recurrent"
         },
         "aggs":{
            "agg_bucket_sort":{
               "bucket_sort":{
                  "from":0,
                  "size":25,
                  "sort":[
                     {
                        "_key":{
                           "order":"asc"
                        }
                     }
                  ]
               }
            }
         }
      }
   }
}


Clone this wiki locally