Elastic Cloud の filters の使い方
4635 ワード
参考ページ
Search API Filters
サンプルの
national-parks-demo
を使います。
Curl
filter_curl.sh
HOST="https://mar29-project.ent.asia-northeast1.gcp.cloud.es.io"
SEARCH_KEY="search-******"
NAME_ENGINE="national-parks-demo"
#
#
curl -X POST ${HOST}'/api/as/v1/engines/'$NAME_ENGINE'/search' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer '${SEARCH_KEY} \
-d '{
"query": "",
"filters" : {
"states": [ "Texas", "Minnesota" ]
}
}'
go_curl.sh
./filter_curl.sh > out01.json
jq .results[].states out01.json
実行結果
$ ./go_curl.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2646 100 2573 100 73 5105 144 --:--:-- --:--:-- --:--:-- 5302
{
"raw": [
"Texas"
]
}
{
"raw": [
"Minnesota"
]
}
{
"raw": [
"Texas"
]
}
Httpie
filter_http.sh
HOST="https://mar29-project.ent.asia-northeast1.gcp.cloud.es.io"
SEARCH_KEY="search-******"
NAME_ENGINE="national-parks-demo"
#
#
http ${HOST}'/api/as/v1/engines/'$NAME_ENGINE'/search' \
'Authorization: Bearer '${SEARCH_KEY} < query01.json
query01.json
{
"query": "",
"filters" : { "states": [ "Texas", "Minnesota" ] }
}
go_http.sh
./filter_http.sh > out02.json
jq .results[].states out02.json
実行結果
$ ./go_http.sh
{
"raw": [
"Texas"
]
}
{
"raw": [
"Minnesota"
]
}
{
"raw": [
"Texas"
]
}
Author And Source
この問題について(Elastic Cloud の filters の使い方), 我々は、より多くの情報をここで見つけました https://qiita.com/ekzemplaro/items/1ab696e2d230a59b548d著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .