Sorting Problem, ClassCastException


(Curt Hu) #1

In my document I have field called created like "2014-07-25T06:02:00", the mappings is:
created: {
format: dateOptionalTime
type: date
}

Here with the range query on that is fine, but why sort on that field I got:
{
error: ReduceSearchPhaseException[Failed to execute phase [query], [reduce] ]; nested: ClassCastException[java.lang.Long cannot be cast to org.apache.lucene.util.BytesRef];
status: 503
}


(Jörg Prante) #2

Which ES version?

Jörg

On Sat, Jul 26, 2014 at 1:21 AM, Curt Hu zhongting.hu@gmail.com wrote:

In my document I have field called created like "2014-07-25T06:02:00", the
mappings is:
created: {
format: dateOptionalTime
type: date
}

Here with the range query on that is fine, but why sort on that field I
got:
{
error: ReduceSearchPhaseException[Failed to execute phase [query], [reduce]
]; nested: ClassCastException[java.lang.Long cannot be cast to
org.apache.lucene.util.BytesRef];
status: 503
}

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Sorting-Problem-ClassCastException-tp4060659.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/1406330468734-4060659.post%40n3.nabble.com
.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFksqcbCRgRBem%2B9Wh%3De-6hH54cgSg%3DZs_ecOLFLf63cA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Ian Harrigan) #3

Im getting the exact same problem... ES version 1.2.1... If i use
something like this:

{
"from" : 0,
"size" : 10,
"query" : {
"match_all" : { }
}
}

All fine... However, if i have a sort on it, eg:

{
"from" : 0,
"size" : 10,
"query" : {
"match_all" : { }
},
"sort" : [ {
"dateTime" : {
"order" : "desc"
}
} ]
}

Then i get:

[2014-08-06 12:31:01,685][DEBUG][action.search.type ] [Maur-Konn] [
portal-boots-2014-08][0]: Failed to execute [org.elasticsearch.action.search
.SearchRequ
est@558af98a] while moving to second phase
java.lang.ClassCastException: java.lang.Long cannot be cast to org.apache.
lucene.util.BytesRef
at org.apache.lucene.util.BytesRef.compareTo(BytesRef.java:33)
at org.apache.lucene.search.FieldComparator.compareValues(
FieldComparator.java:221)
at org.elasticsearch.search.controller.ShardFieldDocSortedHitQueue.
lessThan(ShardFieldDocSortedHitQueue.java:118)
at org.elasticsearch.search.controller.ShardFieldDocSortedHitQueue.
lessThan(ShardFieldDocSortedHitQueue.java:35)
at org.apache.lucene.util.PriorityQueue.insertWithOverflow(
PriorityQueue.java:159)
at org.elasticsearch.search.controller.SearchPhaseController.
sortDocs(SearchPhaseController.java:360)
at org.elasticsearch.search.controller.SearchPhaseController.
sortDocs(SearchPhaseController.java:146)
at org.elasticsearch.action.search.type.
TransportSearchQueryThenFetchAction$AsyncAction.moveToSecondPhase(
TransportSearchQueryThenFetchAction.java:85)
at org.elasticsearch.action.search.type.
TransportSearchTypeAction$BaseAsyncAction.innerMoveToSecondPhase(
TransportSearchTypeAction.java:404)
at org.elasticsearch.action.search.type.
TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(
TransportSearchTypeAction.java:198)
at org.elasticsearch.action.search.type.
TransportSearchTypeAction$BaseAsyncAction$1.onResult(
TransportSearchTypeAction.java:174)
at org.elasticsearch.action.search.type.
TransportSearchTypeAction$BaseAsyncAction$1.onResult(
TransportSearchTypeAction.java:171)
at org.elasticsearch.search.action.SearchServiceTransportAction$23.
run(SearchServiceTransportAction.java:526)
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:744)

This is something to do with using multiple indexes as when i use the query
with the inquisitor plugin and a single index it works fine. Is there a
work around for this? This is causing a major problem in our production
environment.

Thanks in advance,
Ian

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/50e58d06-14d6-4c22-80ad-9058c52f4eb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4