【问题标题】:How pass ignore_unavailable as query parameter to elasticsearch search request?如何将 ignore_unavailable 作为查询参数传递给 elasticsearch 搜索请求?
【发布时间】:2017-11-20 10:25:17
【问题描述】:

我正在尝试调用(注意这里有多个索引):

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

得到:

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

当索引之一不存在时,如何将ignore_unavailable 包含为参数或使搜索失败?

ES 版本为5.3

【问题讨论】:

    标签: elasticsearch elasticsearch-5


    【解决方案1】:

    这个查询对我有用。

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

    【讨论】:

    • 酷!它似乎与 chrome sense 插件有问题:)
    猜你喜欢
    • 1970-01-01
    • 2012-08-28
    • 1970-01-01
    • 2021-08-18
    • 2022-12-15
    • 1970-01-01
    • 2017-06-25
    • 2019-11-11
    • 2019-07-24
    相关资源
    最近更新 更多