# Question re implementing routing

**URL:** <https://discuss.elastic.co/t/question-re-implementing-routing/2509>\
**Category:** Elasticsearch\
**Created:** [June 11, 2015, 7:24pm UTC](https://discuss.elastic.co/t/question-re-implementing-routing/2509 "2015-06-11T19:24:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdeconto](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gdeconto](https://discuss.elastic.co/u/gdeconto)\
**Post date:** [June 11, 2015, 7:24pm UTC](https://discuss.elastic.co/t/question-re-implementing-routing/2509/1 "2015-06-11T19:24:45Z")

</div>

I am having some issues implementing routing in an index I am working on, and would really appreciate some help.

After implementing routing in the schema, I created a new index with that schema and populated it. When I check the mapping using "GET myindex/mytype/\_mapping", I see the routing configuration and it appears (to me) to be properly set up.

The routing field is called identifiers.state\_code and it a string and contains a state code value for each document.

Since I didn't define a specific analyser, ElasticSearch should automatically configure it as a full-text string field and analyze it with the standard analyzer, which includes lower-casing (this per the documentation)

However, routing does not appear to be working as the following two queries return different results:

GET myindex/\_search?routing=ar  
GET myindex/\_search?routing=AR

The lowercase version of the command doesn't even return the routing value I am specified (found this when I added faceting of the state code values to the command to see the various values).

Can anyone tell me what I am doing wrong with the routing configuration? Any and all help appreciated.

Here is a snippet (to keep it short) from the results of running "GET myindex/mytype/\_mapping":

{  
"myindex": {  
"mappings": {  
"mytype": {  
"\_all": {  
"enabled": false  
},  
"\_id": {  
"path": "id"  
},  
"\_routing": {  
"required": true,  
"path": "identifiers.state\_code"  
},  
"\_timestamp": {  
"enabled": true  
},  
"\_index": {  
"enabled": true  
},  
"properties": {  
"identifiers": {  
"properties": {  
"primary\_id": {  
"type": "long"  
},  
"state\_code": {  
"type": "string",  
"norms": {  
"enabled": false  
}  
},  
...  
}  
},  
...

---

<div class="post-metadata">

**Author:** ![gdeconto](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gdeconto](https://discuss.elastic.co/u/gdeconto)\
**Post date:** [June 11, 2015, 8:30pm UTC](https://discuss.elastic.co/t/question-re-implementing-routing/2509/2 "2015-06-11T20:30:38Z")

</div>

note:

I do understand that GET myindex/\_search?routing=ar and GET myindex/\_search?routing=AR would produce different results if the values in identifiers.state\_code were different; ie docs with state\_code=ar would go in one shard and docs with state\_code=AR may go into another shard

my concern is that the routing values in identifiers.state\_code should always be lowercased (due to standard analyzer being default for string values), so I should only get results for GET myindex/\_search?routing=ar

It looks like when indexing the docs, routing uses the unanalyzed values in identifiers.state\_code.

Is that correct?

---

<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, 12:08am UTC](https://discuss.elastic.co/t/question-re-implementing-routing/2509/3 "2017-07-06T00:08:02Z")

</div>


