Getting Exception while running Stats-Aggregation in Elasticsearch 1.6


(Abhay Verma) #1

I have 2 index types a) Custom_Pattern_1, b) Custom_DataType_2 inside 'bw-2016-01-15-06-006' index. For both of these index types, I have two field of same name but different data types

Custom_Pattern_1- Custom_DataType - String
Custom_DataType_2 - Custom_DataType - Long

I am running below query for aggregation.

POST bw-2016-01-15-06-006/Custom_DataType_2/_search
{
  "from" : 0,
  "size" : 100,
  "aggregations" : {
        "Custom_DataType" : {
          "extended_stats" : {
            "field" : "Custom_DataType"
          }
        }
      }
}

Though I am running query only on Custom_DataType2 inside 'bw-2016-01-15-06-006' index in which Custom_DataType is long, it should have returned the results. But I am getting below ClassCastException.

{
   "error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[-lo5bj-4TLOcyZwfl6oPyA][bw-2016-01-15-06-006][0]: ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData]}{[-lo5bj-4TLOcyZwfl6oPyA][bw-2016-01-15-06-006][1]: ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData]}{[-lo5bj-4TLOcyZwfl6oPyA][bw-2016-01-15-06-006][2]: ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData]}{[-lo5bj-4TLOcyZwfl6oPyA][bw-2016-01-15-06-006][3]: ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData]}]",
   "status": 500
}

I am still using Elasticsearch 1.6 and according to documents one index can have 2 fields of same name with different data types. Can somebody help me on this


(system) #2