Logstash查询elasticsearch geohash数据

时间:2016-09-22 13:17:28

标签: elasticsearch logstash elasticsearch-plugin logstash-configuration geohashing

我正在使用geohash聚合位置数据,这在Chrome Sense插件上运行良好,但是一旦我尝试通过logstash作为elasticsearch的输入插件进行查询,它就无法工作...... 我的感觉查询:

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
        }
    }
} } }'  }}}

我的logstash异常:

←[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

0 个答案:

没有答案