我正在使用 geohash 聚合位置数据,这在 Chrome Sense 插件上运行良好,但是一旦我尝试通过 logstash 作为 elasticsearch 的输入插件进行查询,它就无法正常工作......我的 Sense 查询:
POST/_search
{
"query": {
"match_all": {}
},
"aggs": {
"my_area": {
"geohash_grid": {
"field": "location",
"precision": 6
}
}
}
}
我的logstash配置文件:
input { elasticsearch {
hosts => "localhost:9200"
index => "devices"
query => '{"query":
{
"aggs": {
"my_area": {
"geohash_grid": {
"field": "location",
"precision": 6
}
}
} } }' }}}
我的日志存储异常:
←[31mA plugin had an unrecoverable error. Will restart this plugin.
Plugin: <LogStash::Inputs::Elasticsearch hosts=>["localhost:9200"], index=>"de
vices", query=>"{\"query\": \n\t{ \n\t\"aggs\": {\n \"my_area\": {\n \"
geohash_grid\": { \n \"field\": \"location\",\n \"precision\":
6\n\t\t\t}\n\t\t}\n\t} } }", codec=><LogStash::Codecs::JSON charset=>"UTF-8">,
scan=>true, size=>1000, scroll=>"1m", docinfo=>false, docinfo_target=>"@metadata
", docinfo_fields=>["_index", "_type", "_id"], ssl=>false>
Error: [400] {"error":{"root_cause":[{"type":"query_parsing_exception","reason
":"No query registered for [aggs]","index":"devices","line":3,"col":2}],"type":"
search_phase_execution_exception","reason":"all shards failed","phase":"init_sca
n","grouped":true,"failed_shards": [{"shard":0,"index":"devices","node":"fcYfrzLA
QQeQ4q9skTAHNw","reason":{"type":"query_parsing_exception","reason":"No query re
gistered for [aggs]","index":"devices","line":3,"col":2}}]},"status":400} {:leve
l=>:error}←[0m