gpt4 book ai didi

elasticsearch - 如何将 ignore_unavailable 作为查询参数传递给 elasticsearch 搜索请求?

转载 作者:行者123 更新时间:2023-12-02 22:12:45 27 4
gpt4 key购买 nike

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

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

最佳答案

这个查询对我有用。

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

关于elasticsearch - 如何将 ignore_unavailable 作为查询参数传递给 elasticsearch 搜索请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47389812/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com