Elasticsearch aggregate Query from logstash

Hi All,

I want to aggregate an index in elasticsearch using logstash and store that aggregate result in another index.

input {
  elasticsearch {
    hosts => "http://50.254.92.204:9200" 
    user => "elastic"
    password => "changeme"	
    index => "students"
    query => '{"query" : {"constant_score" : {"filter" : {"match" : { "name" : "Vinoth" }}}},"size": 0,"aggs": {"Vinoth_avg_marks": {"avg" : { "field" : "mark" } }}}'
	size => 500 
    scroll => "5m" 
    docinfo => true
  }
}


filter {

}
output {

  stdout { codec => rubydebug } 

  elasticsearch {
    hosts => "50.254.92.204:9200" 
    user => "elastic"
    password => "changeme"	  
    index => "test" 
    document_type => "test"
    #document_id => "%{[@metadata][_id]}"
  }
}

But aggregate result is not being pushed into the test index.

Thanks in advance

Hi all,

Any update on this ...
Please guide me whether this is possible in logstash or not...Or I may be missing something
Let me know as soon as possible

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.