Failed to execute [org.elasticsearch.action.search.SearchRequest@8307e49] while moving to second phase java.lang.ClassCastException: java.lang.Long cannot be cast to org.apache.lucene.util.BytesRef at org.apache.lucene.search.FieldComparator$TermOrdValComparator.compareValues(FieldComparator.java:902) at org.apache.lucene.search.TopDocs$MergeSortQueue.lessThan(TopDocs.java:172) at org.apache.lucene.search.TopDocs$MergeSortQueue.lessThan(TopDocs.java:120) at org.apache.lucene.util.PriorityQueue.upHeap(PriorityQueue.java:225) at org.apache.lucene.util.PriorityQueue.add(PriorityQueue.java:133) at org.apache.lucene.search.TopDocs.merge(TopDocs.java:234) at org.elasticsearch.search.controller.SearchPhaseController.sortDocs(SearchPhaseController.java:239) at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.moveToSecondPhase(TransportSearchQueryThenFetchAction.java:89) at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.innerMoveToSecondPhase(TransportSearchTypeAction.java:403) at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:202) at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.onResult(TransportSearchTypeAction.java:178) at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.onResult(TransportSearchTypeAction.java:175) at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:568) 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)