# ClassCastException on Sort

**URL:** <https://discuss.elastic.co/t/classcastexception-on-sort/17765>\
**Category:** Elasticsearch\
**Created:** [May 27, 2014, 9:55pm UTC](https://discuss.elastic.co/t/classcastexception-on-sort/17765 "2014-05-27T21:55:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![VB1](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@VB1](https://discuss.elastic.co/u/VB1)\
**Post date:** [May 27, 2014, 9:55pm UTC](https://discuss.elastic.co/t/classcastexception-on-sort/17765/1 "2014-05-27T21:55:18Z")

</div>

We are using 90.11 and we have a use case where have following type

- accountsearch: {
  - dynamic: strict
  - properties: {
    - Name: {
      - index: not\_analyzed
      - norms: {
        - enabled: false  
}

      - index\_options: docs
      - type: string  
}

    - Description: {
      - index: not\_analyzed
      - norms: {
        - enabled: false  
}

      - index\_options: docs
      - type: string  
}

    - TransactionIdList: {
      - properties: {
        - transactionId: {
          - type: long  
}  
}

      - type: nested  
}

    - Number: {
      - index: not\_analyzed
      - norms: {
        - enabled: false  
}

      - index\_options: docs
      - type: string  
}

    - CreateUserId: {
      - type: integer  
}

    - Id: {
      - type: long  
}

    - ExposedPartyName: {
      - index: not\_analyzed
      - norms: {
        - enabled: false  
}

      - index\_options: docs
      - type: string  
}

    - RiskItemCount: {
      - type: long  
}

    - SourceId: {
      - index: not\_analyzed
      - norms: {
        - enabled: false  
}

      - index\_options: docs
      - type: string  
}

    - ContractCount: {
      - type: long  
}  
}  
}

On and off we get ClassCastException converting Long to String when we do  
following query. When we remove Sort from query it works fine. I checked  
my all other types none of the type has field "Id" with String data type.

{  
"sort": "Id",  
"query": {  
"bool": {  
"must": [  
{  
"range": {  
"Id": {  
"gt": "0"  
}  
}  
}  
]  
}  
}  
}

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ff65a528-7529-49a0-aeb3-0d4d7638290b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ff65a528-7529-49a0-aeb3-0d4d7638290b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![VB1](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@VB1](https://discuss.elastic.co/u/VB1)\
**Post date:** [May 27, 2014, 10:02pm UTC](https://discuss.elastic.co/t/classcastexception-on-sort/17765/2 "2014-05-27T22:02:05Z")

</div>

Clearing field cache solves this issue. But we need to the final solution.

On Tuesday, 27 May 2014 14:55:18 UTC-7, VB wrote:

> We are using 90.11 and we have a use case where have following type
> 
> - accountsearch: {
> - dynamic: strict
> - properties: {
> - Name: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - Description: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - TransactionIdList: {
> - properties: {
> - transactionId: {
> - type: long  
> }  
> }
> 
> - type: nested  
> }
> 
> - Number: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - CreateUserId: {
> - type: integer  
> }
> 
> - Id: {
> - type: long  
> }
> 
> - ExposedPartyName: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - RiskItemCount: {
> - type: long  
> }
> 
> - SourceId: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - ContractCount: {
> - type: long  
> }  
> }  
> }
> 
> On and off we get ClassCastException converting Long to String when we do  
> following query. When we remove Sort from query it works fine. I checked  
> my all other types none of the type has field "Id" with String data type.
> 
> {  
> "sort": "Id",  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "range": {  
> "Id": {  
> "gt": "0"  
> }  
> }  
> }  
> ]  
> }  
> }  
> }

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4f6b4790-c557-451e-9457-2f35fd06a6f7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4f6b4790-c557-451e-9457-2f35fd06a6f7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![VB1](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@VB1](https://discuss.elastic.co/u/VB1)\
**Post date:** [May 28, 2014, 5:40pm UTC](https://discuss.elastic.co/t/classcastexception-on-sort/17765/3 "2014-05-28T17:40:58Z")

</div>

Can anyone please help us here? Clearing field cache every single time  
cannot work for production.

On Tuesday, 27 May 2014 14:55:18 UTC-7, VB wrote:

> We are using 90.11 and we have a use case where have following type
> 
> - accountsearch: {
> - dynamic: strict
> - properties: {
> - Name: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - Description: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - TransactionIdList: {
> - properties: {
> - transactionId: {
> - type: long  
> }  
> }
> 
> - type: nested  
> }
> 
> - Number: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - CreateUserId: {
> - type: integer  
> }
> 
> - Id: {
> - type: long  
> }
> 
> - ExposedPartyName: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - RiskItemCount: {
> - type: long  
> }
> 
> - SourceId: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - ContractCount: {
> - type: long  
> }  
> }  
> }
> 
> On and off we get ClassCastException converting Long to String when we do  
> following query. When we remove Sort from query it works fine. I checked  
> my all other types none of the type has field "Id" with String data type.
> 
> {  
> "sort": "Id",  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "range": {  
> "Id": {  
> "gt": "0"  
> }  
> }  
> }  
> ]  
> }  
> }  
> }

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/52f17c03-7cb9-4e74-9e73-616f38494080%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52f17c03-7cb9-4e74-9e73-616f38494080%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![VB1](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@VB1](https://discuss.elastic.co/u/VB1)\
**Post date:** [May 28, 2014, 6:00pm UTC](https://discuss.elastic.co/t/classcastexception-on-sort/17765/4 "2014-05-28T18:00:22Z")

</div>

This is the stack trace from the logs.

[2014-05-27 20:20:42,173][DEBUG][action.search.type] [BUS2F02DC48]  
[1002\_exposureindex][44], node[yo\_IkCIITISXPzmODzGHDw], [P], s[STARTED]:  
Failed to execute [org.elasticsearch.action.search.SearchRequest@639991c0]  
lastShard [true]  
org.elasticsearch.transport.SendRequestTransportException:  
[ELS-10.76.124.220][inet[/10.76.124.220:9300]][search/phase/query]  
at  
org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:202)  
at  
org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:173)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:208)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:216)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$4.run(TransportSearchTypeAction.java:292)  
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)  
Caused by: org.elasticsearch.transport.NodeNotConnectedException:  
[ELS-10.76.124.220][inet[/10.76.124.220:9300]] Node not connected  
at  
org.elasticsearch.transport.netty.NettyTransport.nodeChannel(NettyTransport.java:859)  
at  
org.elasticsearch.transport.netty.NettyTransport.sendRequest(NettyTransport.java:540)  
at  
org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:189)  
... 8 more  
[2014-05-27 20:19:46,712][DEBUG][action.search.type] [BUS2F02DC48]  
[1002\_exposureindex][44], node[5V8bqkEzTP2TzMukB5\_j-Q], [R], s[STARTED]:  
Failed to execute [org.elasticsearch.action.search.SearchRequest@504b783d]  
lastShard [true]  
org.elasticsearch.transport.NodeDisconnectedException:  
[ELS-10.76.122.38][inet[/10.76.122.38:9300]][search/phase/query]  
disconnected  
[2014-05-27 20:43:55,187][INFO][node] [BUS2F02DC48]  
version[0.90.11], pid[15504], build[11da1ba/2014-02-03T15:27:39Z]  
[2014-05-27 20:43:55,187][INFO][node] [BUS2F02DC48]  
initializing ...  
[2014-05-27 20:43:55,203][INFO][plugins] [BUS2F02DC48]  
loaded [action-updatebyquery], sites   
[2014-05-27 20:43:57,122][INFO][node] [BUS2F02DC48]  
initialized  
[2014-05-27 20:43:57,122][INFO][node] [BUS2F02DC48]  
starting ...  
[2014-05-27 20:43:57,340][INFO][transport] [BUS2F02DC48]  
bound\_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish\_address  
{inet[/10.76.122.120:9300]}  
[2014-05-27 20:44:00,632][INFO][cluster.service] [BUS2F02DC48]  
detected\_master  
[ELS-10.76.121.130][BlGygpFmRn6uQNbgiEfl0A][inet[/10.76.121.130:9300]]{data=false,  
max\_local\_storage\_nodes=1, master=true}, added  
{[ELS-10.76.125.37][j3VQFYDaQLujkprUnke02w][inet[/10.76.125.37:9300]]{max\_local\_storage\_nodes=1,  
master=false},[EDI1AE3EE57][A-P-y5chQbi0rwGtoeLgCQ][inet[/10.76.124.227:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.122.38][5V8bqkEzTP2TzMukB5\_j-Q][inet[/10.76.122.38:9300]]{max\_local\_storage\_nodes=1,  
master=false},[EDI1A1EA928][A2wtbMKQS-iA23ZUftdyrQ][inet[/10.76.120.82:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.125.48][TGlF1uv8Q5GpgBVvIcvRAQ][inet[/10.76.125.48:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.120.62][evcNI2CqSs-Zz44Jdzn0aw][inet[/10.76.120.62:9300]]{client=true,  
data=false, max\_local\_storage\_nodes=1,  
master=false},[BUS2F2801F3][1nhECnFYTmGpGBYbS\_9\_oA][inet[/10.76.122.123:9300]]{client=true,  
data=false,  
master=false},[EDSFB1ABF7][S0\_G2lKIQUCchKit6o55fw][inet[/10.76.122.19:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.124.220][yo\_IkCIITISXPzmODzGHDw][inet[/10.76.124.220:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.125.38][RyeswSy8SquV5H8Vfsw75Q][inet[/10.76.125.38:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.125.44][ot8ch3V6TYGKOLYnCY9cYw][inet[/10.76.125.44:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.124.214][H8N9nIU0TKyGv\_prKyRVCQ][inet[/10.76.124.214:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.125.40][hp4wvQxER-mMPygey2Iqgg][inet[/10.76.125.40:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.122.67][BiXop5iCRgGQyGvxazMkQg][inet[/10.76.122.67:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.121.129][pf9xpva7Q4izIy6Nj4S4iQ][inet[/10.76.121.129:9300]]{data=false,  
max\_local\_storage\_nodes=1,  
master=true},[EDSF899A97][sNow97GZS76IotSm-0tfAg][inet[/10.76.122.17:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.125.46][nXceQp40TjOSctChaGVtKw][inet[/10.76.125.46:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.121.188][oWldDeY4TJioki90moNySw][inet[/10.76.121.188:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.122.34][kPSYm9G8R8i\_z2skK\_jq1g][inet[/10.76.122.34:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.125.43][JMgOIZFBSzaQZ9bVagG57w][inet[/10.76.125.43:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.124.225][nTPlE6IkTHOZ7EThX-hLeQ][inet[/10.76.124.225:9300]]{max\_local\_storage\_nodes=1,  
master=false},[BUS936E1B3][DGGcjpU7TxuJaa3cRZ4oFg][inet[/10.76.123.122:9300]]{client=true,  
data=false,  
master=false},[EDS1DFC2FCE][kmfuyX24RO-2cYhYSuEhhQ][inet[/10.76.121.248:9300]]{client=true,  
data=false,  
master=false},[EDI1AB0123F][535FTQhVQsOJthEADxZeqA][inet[/10.76.124.18:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.125.47][MV8eSvpbRtCS1MAK2iAcVg][inet[/10.76.125.47:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.120.61][\_60f636\_QsOPIWN0tKyN2A][inet[/10.76.120.61:9300]]{client=true,  
data=false, max\_local\_storage\_nodes=1,  
master=false},[BUS9364B62][nOkPLHZYQyO\_QRMiSsAhxg][inet[/10.76.123.123:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.121.186][h8J-VleORCGTU8WbfnIuEw][inet[/10.76.121.186:9300]]{max\_local\_storage\_nodes=1,  
master=false},[EDSFB1200C][278Hf8Z9TC-bYefRJMDtAg][inet[/10.76.122.18:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.121.131][dg\_r12\_nQbqIT\_oJfjTwTg][inet[/10.76.121.131:9300]]{data=false,  
max\_local\_storage\_nodes=1,  
master=true},[ELS-10.76.122.39][swxUZAjCTCeBZS2-Uo\_Bpw][inet[/10.76.122.39:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.125.39][ujy-dthBSj-vpi23kyEr3w][inet[/10.76.125.39:9300]]{max\_local\_storage\_nodes=1,  
master=false},[EDSFB2D1AD][Xqq1f0m0TYivDRIURmKz6g][inet[/10.76.122.21:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.120.63][CsOrvy-3SoSewoSnj4Eyzw][inet[/10.76.120.63:9300]]{client=true,  
data=false, max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.125.45][LZtJHDJ3TQqTbCOnqyFAHw][inet[/10.76.125.45:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.121.187][GXrdLXeJSGmUfSLD3qoqlw][inet[/10.76.121.187:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.122.37][TBw4vykLR\_uRT76gt23UUQ][inet[/10.76.122.37:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.122.36][uMjtmuRzQUW9i09Og\_DdvQ][inet[/10.76.122.36:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.125.50][jv7xpDnpTiOo21Kg\_JgkVw][inet[/10.76.125.50:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.124.223][WeuqeKYaS--2lGGpfgeV7w][inet[/10.76.124.223:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.124.224][fxfz13VnSPOs4lv6BGelPQ][inet[/10.76.124.224:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.124.221][nB65C4WGRiSCntVZoovX\_Q][inet[/10.76.124.221:9300]]{max\_local\_storage\_nodes=1,  
master=false},[EDS1A1F2240][5O9JG6PtR22fJt3R9kFl6A][inet[/10.76.120.87:9300]]{client=true,  
data=false,  
master=false},[EDS1A1EDBF0][gUdvmu7gTxWkqZiniB-fqA][inet[/10.76.120.84:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.120.64][kUK0ylSfQoaExLGOp9q0dg][inet[/10.76.120.64:9300]]{client=true,  
data=false, max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.124.218][0hShFOjuSvCEmR1LW6jQSQ][inet[/10.76.124.218:9300]]{max\_local\_storage\_nodes=1,  
master=false},[ELS-10.76.125.36][ioXkziSRTRKeml-4oXRNRw][inet[/10.76.125.36:9300]]{max\_local\_storage\_nodes=1,  
master=false},[EDI1AE4FD76][ZFuyPAc1Rj6CJKaXkuYqeg][inet[/10.76.124.228:9300]]{client=true,  
data=false,  
master=false},[STG0A4C78E2][eM2OxZ8\_TYy95CXMikm4kQ][inet[/10.76.120.226:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.122.35][usJjEG65Tk6D4YnVHz220w][inet[/10.76.122.35:9300]]{max\_local\_storage\_nodes=1,  
master=false},[EDS1A1EF360][U81zEf7VQbmjG5jGBluL8Q][inet[/10.76.120.85:9300]]{client=true,  
data=false,  
master=false},[EDS1A1F0AD0][1RoPGIhwSrSf6UEyIWWGNQ][inet[/10.76.120.86:9300]]{client=true,  
data=false,  
master=false},[EDSFB21E69][ski1xB\_0SGCLMofPVWFVyA][inet[/10.76.122.20:9300]]{client=true,  
data=false,  
master=false},[ELS-10.76.121.130][BlGygpFmRn6uQNbgiEfl0A][inet[/10.76.121.130:9300]]{data=false,  
max\_local\_storage\_nodes=1,  
master=true},[ELS-10.76.125.49][IeM2iMC4SbuzPWcsgTrR1w][inet[/10.76.125.49:9300]]{max\_local\_storage\_nodes=1,  
master=false},[EDI1A1EC098][10ElWcDPT86FjaAqeMUeZg][inet[/10.76.120.83:9300]]{client=true,  
data=false, master=false},}, reason: zen-disco-receive(from master  
[[ELS-10.76.121.130][BlGygpFmRn6uQNbgiEfl0A][inet[/10.76.121.130:9300]]{data=false,  
max\_local\_storage\_nodes=1, master=true}])  
[2014-05-27 20:44:00,804][INFO][discovery] [BUS2F02DC48]  
QE1\_SearchLayer/q-wrNuFeTtu0nJTSYtwFow  
[2014-05-27 20:44:00,928][INFO][http] [BUS2F02DC48]  
bound\_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address  
{inet[/10.76.122.120:9200]}  
[2014-05-27 20:44:00,928][INFO][node] [BUS2F02DC48]  
started  
[2014-05-27 20:49:49,104][DEBUG][action.search.type] [BUS2F02DC48]  
[1001\_exposureindex][15]: Failed to execute  
[org.elasticsearch.action.search.SearchRequest@39ef1bc6] while moving to  
second phase  
java.lang.ClassCastException: java.lang.Long cannot be cast to  
org.apache.lucene.util.BytesRef  
at  
org.elasticsearch.search.controller.ShardFieldDocSortedHitQueue.lessThan(ShardFieldDocSortedHitQueue.java:102)  
at  
org.elasticsearch.search.controller.ShardFieldDocSortedHitQueue.lessThan(ShardFieldDocSortedHitQueue.java:35)  
at  
org.apache.lucene.util.PriorityQueue.insertWithOverflow(PriorityQueue.java:158)  
at  
org.elasticsearch.search.controller.SearchPhaseController.sortDocs(SearchPhaseController.java:249)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.moveToSecondPhase(TransportSearchQueryThenFetchAction.java:85)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.innerMoveToSecondPhase(TransportSearchTypeAction.java:417)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:241)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onResult(TransportSearchTypeAction.java:219)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onResult(TransportSearchTypeAction.java:216)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction$4.handleResponse(SearchServiceTransportAction.java:217)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction$4.handleResponse(SearchServiceTransportAction.java:208)  
at  
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:154)  
at  
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125)  
at  
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)  
at  
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)  
at  
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)  
at  
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)  
at  
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)  
at  
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)  
at  
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)  
at  
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)  
at  
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)  
at  
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)  
at  
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)  
at  
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)  
at  
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)  
at  
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)  
at  
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)  
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)

On Tuesday, 27 May 2014 14:55:18 UTC-7, VB wrote:

> We are using 90.11 and we have a use case where have following type
> 
> - accountsearch: {
> - dynamic: strict
> - properties: {
> - Name: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - Description: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - TransactionIdList: {
> - properties: {
> - transactionId: {
> - type: long  
> }  
> }
> 
> - type: nested  
> }
> 
> - Number: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - CreateUserId: {
> - type: integer  
> }
> 
> - Id: {
> - type: long  
> }
> 
> - ExposedPartyName: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - RiskItemCount: {
> - type: long  
> }
> 
> - SourceId: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - ContractCount: {
> - type: long  
> }  
> }  
> }
> 
> On and off we get ClassCastException converting Long to String when we do  
> following query. When we remove Sort from query it works fine. I checked  
> my all other types none of the type has field "Id" with String data type.
> 
> {  
> "sort": "Id",  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "range": {  
> "Id": {  
> "gt": "0"  
> }  
> }  
> }  
> ]  
> }  
> }  
> }

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b7cd4ea3-2240-480a-a0c3-c170630d37dd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b7cd4ea3-2240-480a-a0c3-c170630d37dd%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![VB1](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@VB1](https://discuss.elastic.co/u/VB1)\
**Post date:** [May 29, 2014, 5:20pm UTC](https://discuss.elastic.co/t/classcastexception-on-sort/17765/5 "2014-05-29T17:20:04Z")

</div>

Can anyone please provide us insight on this, specially someone from ES  
core dev team, this is bug in elasticsearch code.

On Tuesday, 27 May 2014 14:55:18 UTC-7, VB wrote:

> We are using 90.11 and we have a use case where have following type
> 
> - accountsearch: {
> - dynamic: strict
> - properties: {
> - Name: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - Description: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - TransactionIdList: {
> - properties: {
> - transactionId: {
> - type: long  
> }  
> }
> 
> - type: nested  
> }
> 
> - Number: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - CreateUserId: {
> - type: integer  
> }
> 
> - Id: {
> - type: long  
> }
> 
> - ExposedPartyName: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - RiskItemCount: {
> - type: long  
> }
> 
> - SourceId: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - ContractCount: {
> - type: long  
> }  
> }  
> }
> 
> On and off we get ClassCastException converting Long to String when we do  
> following query. When we remove Sort from query it works fine. I checked  
> my all other types none of the type has field "Id" with String data type.
> 
> {  
> "sort": "Id",  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "range": {  
> "Id": {  
> "gt": "0"  
> }  
> }  
> }  
> ]  
> }  
> }  
> }

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/52122b0a-9304-4e65-b212-11cb3cfc43c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52122b0a-9304-4e65-b212-11cb3cfc43c2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![VB1](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@VB1](https://discuss.elastic.co/u/VB1)\
**Post date:** [May 30, 2014, 6:11pm UTC](https://discuss.elastic.co/t/classcastexception-on-sort/17765/6 "2014-05-30T18:11:03Z")

</div>

This only happens when we sort by "Id" field. is there something special  
with field Name as "Id".

On Tuesday, 27 May 2014 14:55:18 UTC-7, VB wrote:

> We are using 90.11 and we have a use case where have following type
> 
> - accountsearch: {
> - dynamic: strict
> - properties: {
> - Name: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - Description: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - TransactionIdList: {
> - properties: {
> - transactionId: {
> - type: long  
> }  
> }
> 
> - type: nested  
> }
> 
> - Number: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - CreateUserId: {
> - type: integer  
> }
> 
> - Id: {
> - type: long  
> }
> 
> - ExposedPartyName: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - RiskItemCount: {
> - type: long  
> }
> 
> - SourceId: {
> - index: not\_analyzed
> - norms: {
> - enabled: false  
> }
> 
> - index\_options: docs
> - type: string  
> }
> 
> - ContractCount: {
> - type: long  
> }  
> }  
> }
> 
> On and off we get ClassCastException converting Long to String when we do  
> following query. When we remove Sort from query it works fine. I checked  
> my all other types none of the type has field "Id" with String data type.
> 
> {  
> "sort": "Id",  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "range": {  
> "Id": {  
> "gt": "0"  
> }  
> }  
> }  
> ]  
> }  
> }  
> }

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4f4a4400-f9c8-4d96-87b3-2129df5252de%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4f4a4400-f9c8-4d96-87b3-2129df5252de%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:25am UTC](https://discuss.elastic.co/t/classcastexception-on-sort/17765/7 "2017-07-06T01:25:42Z")

</div>


