我正在编写Elasticsearch查询,并在URL中指定请求的index
,并在外部JSON文件中指定查询:
curl
curl -s \
-u $user:$pass \
https://example.com:9243/index_name/search
-d @query.json
query.json
{
"size": 5,
"from": 0,
"sort": [
{
"@timestamp": {
"order": "desc",
"unmapped_type": "boolean"
}
}
],
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "source:*.log",
"analyze_wildcard": true
}
}
]
}
},
"_source": {
"include": ["message", "@timestamp"],
"exclude": "_*"
}
}
我想在查询文件中声明索引名称,而不是URL。
index
_index
或query.json
字段
"terms": { "_index": "filebeat*" }
to the query
object 在
中指定索引的正确方法是什么