Json 在有效负载中指定elasticsearch索引 我的问题
我正在编写一个查询,并在URL中指定请求的Json 在有效负载中指定elasticsearch索引 我的问题,json,elasticsearch,indexing,Json,elasticsearch,Indexing,我正在编写一个查询,并在URL中指定请求的索引,在外部JSON文件中指定查询: curl query.json 我的问题 我想在查询文件中声明索引名,而不是URL 我试过什么 将索引或\u索引字段添加到query.json中的各个位置 添加 我的问题 在中指定索引的正确方法是什么?在这里,您将看到可以在json查询中设置索引 如果你有任何问题,请告诉我 curl -s \ -u $user:$pass \ https://example.com:9243/index_na
索引
,在外部JSON文件中指定查询:
curl
query.json
我的问题
我想在查询文件中声明索引名,而不是URL
我试过什么
- 将
或索引
字段添加到\u索引
query.json中的各个位置
- 添加
curl -s \
-u $user:$pass \
https://example.com:9243/index_name/search
-d @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": "_*"
}
}