How pass ignore_unavailable as query parameter to elasticsearch search request?

Viewed 2816

I am trying to invoke (note multiple indexes here):

GET test1,test2/_search?ignore_unavailable=true
{
   "query": {
      "match_all": {}
   },
   "_source": {
    "exclude": [
      "data"
    ]
  }
}

And got:

{
   "message": "When Content-Type:application/x-www-form-urlencoded, URL cannot include query-string parameters (after '?'): '/test1,test2/_search?ignore_unavailable=true'"
}

How include ignore_unavailable as parameters or make search not fail when one of index does not exisit?

ES version is 5.3

1 Answers

This query worked for me.

curl -XGET "http://localhost:9200/test1,test2/_search?
ignore_unavailable=true" -H 'Content-Type: application/json' -d'
 {
  "query": {
    "match_all": {}
 },
 "_source": {
   "excludes": [
    "data"
   ]
 } 
}'
Related