Re: ElasticSearch: access document nested value in groovy script

2015-01-15 Thread Anil Kumar
I found this.

I had to use _source.medals to access the nested documents which are stored 
in disk and not in memory.

Thanks

On Wednesday, January 14, 2015 at 10:55:15 AM UTC-8, Anil Kumar wrote:

 I have a document stored in ElasticSearch as below. _source:

  {
  firstname: John,
  lastname: Smith,
  medals:[
{
  bucket: 100, 
  count: 1
},
{
  bucket: 150,
  count: 2
}
  ]
   }

 I can access the string type value inside a document using doc.firstname for 
 scripted metric aggregation 
 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html
 .

 But I am not able to get the field value using doc.medals[0].bucket.

 Can you please help me out and let me know how to access the values inside 
 nested fields?


-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/19bd5fb9-b584-441f-8c55-c2f0d2b7d24e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ElasticSearch: access document nested value in groovy script

2015-01-14 Thread Anil Kumar


I have a document stored in ElasticSearch as below. _source:

 {
 firstname: John,
 lastname: Smith,
 medals:[
   {
 bucket: 100, 
 count: 1
   },
   {
 bucket: 150,
 count: 2
   }
 ]
  }

I can access the string type value inside a document using doc.firstname for 
scripted metric aggregation 
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html
.

But I am not able to get the field value using doc.medals[0].bucket.

Can you please help me out and let me know how to access the values inside 
nested fields?

-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/60a4801a-3d76-4f1e-8156-f1cd30dec79b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.