Anyone have some insight re: the following aggregation? I cannot access any 
properties of the document in my script.

With the following query:

{
  "query": {
    "filtered": {
      "filter": [],
      "query": {
        "bool": {
          "must": [
            {
              "query_string": {
                "fields": [
                  "title"
                ],
                "query": "test"
              }
            }
          ]
        }
      }
    }
  },
  "aggs": {
    "my_field": {
      "terms": {
        "field": "my_field.name.raw",
        "script": "doc['title'].value"
      }
    }
  }
}


I get the following error:

QueryPhaseExecutionException[[index_name][2]: query[title:test],from[0],size
[10]: Query Failed [Failed to execute main query]]; nested: 
PropertyAccessException[[Error: doc['title'].value: null] [Near : {... doc[
'title'].value ....}] ^ [Line: 1, Column: 1]]; nested: 
InvocationTargetException; nested: ArrayIndexOutOfBoundsException;

I also try using _source.title, doc.get('title').value, and other 
combinations of the doc['field'] syntax - none are working for me. Is there 
a special nuance for using script within an aggregation? Am I missing 
something obvious?

This fails on both ES 1.1.1 and 1.2.0.

-- 
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/5177724b-0055-464b-8439-e8119a44be1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to