Error sorting on date field


(Pavan BNV) #1

Hi All,

I am getting an error while sorting on date and retrieving records from my index. The shards are failed and the reason mentioned is "PagedBytesIndexFieldData cannot be cast to Atomic Numeric Field Data".

My mapping is

"date" : {
type : "date"
format : "yyyy-MM-dd HH:mm:ss.SSS"
}
Any suggestions please


(Jason Wee) #2

well, i try to reproduce based on your description.

$ curl -XGET 'http://localhost:9200/my_index/_mapping?pretty'
{
  "my_index" : {
    "mappings" : {
      "my_type" : {
        "properties" : {
          "date" : {
            "type" : "date",
            "format" : "yyyy-MM-dd HH:mm:ss.SSS"
          },
          "title" : {
            "type" : "string"
          }
        }
      }
    }
  }
}

and then do the sort

{
"took" : 19,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : null,
"hits" : [ {
"_index" : "my_index",
"_type" : "my_type",
"_id" : "2",
"_score" : null,
"_source":{ "title": "660 6th street", "date": "2015-05-29 20:19:18.456" },
"sort" : [ 1432930758456 ]
}, {
"_index" : "my_index",
"_type" : "my_type",
"_id" : "1",
"_score" : null,
"_source":{ "title": "110 5th Avenue", "date": "2015-05-29 20:19:18.123" },
"sort" : [ 1432930758123 ]
}, {
"_index" : "my_index",
"_type" : "my_type",
"_id" : "3",
"_score" : null,
"_source":{ "title": "Sue never goes anywhere without her alligator skin purse", "date": "2015-05-29 20:19:17.456" },
"sort" : [ 1432930757456 ]
} ]
}
}

there is no exception like you mentioned.

can you give more information like what es are you using? what java version are you using? a few sample of your data and the query you executed such that it gave that exception.

jason


(system) #3