Hi,

I was trying to run the below query from hadoop mapreduce:

{
 "aggs": {
    "group_by_body_part": {
      "terms": {
        "field": "body_part",
        "size": 5,
        "order" : { "examcount" : "desc" }
        },
      "aggs": {
        "examcount": {
          "cardinality": {
            "field": "ExamRowKey"
          }
        }
      }
    }
  }
}

The query is returning more than 5 records, even when the size is given as 
5. 
Also, the result was not aggregated, rather it returns the entire record 
from the index as value to mapper.

Also the following error is logged:

[2014-08-22 16:06:21,459][DEBUG][action.search.type       ] [Algrim the 
Strong] All shards failed for phase: [init_scan]
[2014-08-22 16:26:38,875][DEBUG][action.search.type       ] [Algrim the 
Strong] [mr][0], node[r9u9daW_TkqTBBeazKJQNw], [P], s[STARTED]: Failed to 
execute [org.elasticsearch.action.search.SearchRequest@31b5b771]
org.elasticsearch.search.query.QueryPhaseExecutionException: [mr][0]: 
query[ConstantScore(cache(_type:logs))],from[0],size[50]: Query Failed 
[Failed to execute main query]
        at 
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:162)
        at 
org.elasticsearch.search.SearchService.executeScan(SearchService.java:215)
        at 
org.elasticsearch.search.action.SearchServiceTransportAction$19.call(SearchServiceTransportAction.java:444)
        at 
org.elasticsearch.search.action.SearchServiceTransportAction$19.call(SearchServiceTransportAction.java:441)
        at 
org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:517)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ArrayIndexOutOfBoundsException


Could you please help to create the correct query.

Thanks,
Sona

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/95555a5b-b4b4-4b71-8977-ccc80e0e320d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to