# Can't access stringValue in sort with 0.90

**URL:** <https://discuss.elastic.co/t/cant-access-stringvalue-in-sort-with-0-90/11735>\
**Category:** Elasticsearch\
**Created:** [April 29, 2013, 6:47pm UTC](https://discuss.elastic.co/t/cant-access-stringvalue-in-sort-with-0-90/11735 "2013-04-29T18:47:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darius\_Riggins](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/darius_riggins/32/2374_2.png) [@Darius\_Riggins](https://discuss.elastic.co/u/Darius_Riggins)\
**Post date:** [April 29, 2013, 6:47pm UTC](https://discuss.elastic.co/t/cant-access-stringvalue-in-sort-with-0-90/11735/1 "2013-04-29T18:47:47Z")

</div>

Getting this after doing an upgrade and re-indexing, no query changes.

- error: SearchPhaseExecutionException[Failed to execute phase  
[query\_fetch], total failure; shardFailures  
{[6D6tfWXdQpy7R4okCHRERw][agency][0]:  
QueryPhaseExecutionException[[agency][0]:  
query[name:m\*],from[0],size[10],sort[\<custom:"\_script":  
org.elasticsearch.index.fielddata.fieldcomparator.DoubleScriptDataComparator$InnerSource@2a16b4b1\>!]:  
Query Failed [Failed to execute main query]]; nested:  
PropertyAccessException[[Error: could not access: stringValue; in class:  
org.elasticsearch.index.fielddata.ScriptDocValues$Strings] [Near : {... 10  
/ doc['name.sort'].stringValue.l ....}] ^ [Line: 1, Column: 6]]; }]
- status: 500

{  
"query": {  
"query\_string": {  
"query": "m\*",  
"default\_field": "name",  
"default\_operator": "AND"  
}  
},  
"fields": [  
"agencyOffices",  
"name",  
"\_id"  
],  
"sort": [  
{  
"\_script": {  
"order": "desc",  
"type": "number",  
"script": "10 / doc['name.sort'].stringValue.length() + doc.score"  
}  
}  
],  
"track\_scores": false  
}

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Alger\_Hoi](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Alger\_Hoi](https://discuss.elastic.co/u/Alger_Hoi)\
**Post date:** [May 5, 2013, 12:45am UTC](https://discuss.elastic.co/t/cant-access-stringvalue-in-sort-with-0-90/11735/2 "2013-05-05T00:45:12Z")

</div>

Change the "stringValue" to "value" will work.

On Tuesday, April 30, 2013 2:47:47 AM UTC+8, Darius Riggins wrote:

> Getting this after doing an upgrade and re-indexing, no query changes.
> 
> - error: SearchPhaseExecutionException[Failed to execute phase  
> [query\_fetch], total failure; shardFailures  
> {[6D6tfWXdQpy7R4okCHRERw][agency][0]:  
> QueryPhaseExecutionException[[agency][0]:  
> query[name:m\*],from[0],size[10],sort[\<custom:"\_script":  
> org.elasticsearch.index.fielddata.fieldcomparator.DoubleScriptDataComparator$InnerSource@2a16b4b1\>!]:  
> Query Failed [Failed to execute main query]]; nested:  
> PropertyAccessException[[Error: could not access: stringValue; in class:  
> org.elasticsearch.index.fielddata.ScriptDocValues$Strings] [Near : {... 10  
> / doc['name.sort'].stringValue.l ....}] ^ [Line: 1, Column: 6]]; }]
> - status: 500
> 
> {  
> "query": {  
> "query\_string": {  
> "query": "m\*",  
> "default\_field": "name",  
> "default\_operator": "AND"  
> }  
> },  
> "fields": [  
> "agencyOffices",  
> "name",  
> "\_id"  
> ],  
> "sort": [  
> {  
> "\_script": {  
> "order": "desc",  
> "type": "number",  
> "script": "10 / doc['name.sort'].stringValue.length() + doc.score"  
> }  
> }  
> ],  
> "track\_scores": false  
> }

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [May 5, 2013, 11:43am UTC](https://discuss.elastic.co/t/cant-access-stringvalue-in-sort-with-0-90/11735/3 "2013-05-05T11:43:54Z")

</div>

With the field data refactoring the string|double|longValue version were  
removed so value should work just fine here.

simon

On Sunday, May 5, 2013 2:45:12 AM UTC+2, Alger Hoi wrote:

> Change the "stringValue" to "value" will work.
> 
> On Tuesday, April 30, 2013 2:47:47 AM UTC+8, Darius Riggins wrote:
> 
> > Getting this after doing an upgrade and re-indexing, no query changes.
> > 
> > - error: SearchPhaseExecutionException[Failed to execute phase  
> > [query\_fetch], total failure; shardFailures  
> > {[6D6tfWXdQpy7R4okCHRERw][agency][0]:  
> > QueryPhaseExecutionException[[agency][0]:  
> > query[name:m\*],from[0],size[10],sort[\<custom:"\_script":  
> > org.elasticsearch.index.fielddata.fieldcomparator.DoubleScriptDataComparator$InnerSource@2a16b4b1\>!]:  
> > Query Failed [Failed to execute main query]]; nested:  
> > PropertyAccessException[[Error: could not access: stringValue; in class:  
> > org.elasticsearch.index.fielddata.ScriptDocValues$Strings] [Near : {... 10  
> > / doc['name.sort'].stringValue.l ....}] ^ [Line: 1, Column: 6]]; }]
> > - status: 500
> > 
> > {  
> > "query": {  
> > "query\_string": {  
> > "query": "m\*",  
> > "default\_field": "name",  
> > "default\_operator": "AND"  
> > }  
> > },  
> > "fields": [  
> > "agencyOffices",  
> > "name",  
> > "\_id"  
> > ],  
> > "sort": [  
> > {  
> > "\_script": {  
> > "order": "desc",  
> > "type": "number",  
> > "script": "10 / doc['name.sort'].stringValue.length() + doc.score"  
> > }  
> > }  
> > ],  
> > "track\_scores": false  
> > }

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:38am UTC](https://discuss.elastic.co/t/cant-access-stringvalue-in-sort-with-0-90/11735/4 "2017-07-06T02:38:13Z")

</div>

Closed on July 6, 2017, 2:38am UTC


