# Routing value doesn't match with search result

**URL:** <https://discuss.elastic.co/t/routing-value-doesnt-match-with-search-result/8178>\
**Category:** Elasticsearch\
**Created:** [June 21, 2012, 10:58am UTC](https://discuss.elastic.co/t/routing-value-doesnt-match-with-search-result/8178 "2012-06-21T10:58:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shairon\_Toledo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shairon_toledo/32/2490_2.png) [@Shairon\_Toledo](https://discuss.elastic.co/u/Shairon_Toledo)\
**Post date:** [June 21, 2012, 10:58am UTC](https://discuss.elastic.co/t/routing-value-doesnt-match-with-search-result/8178/1 "2012-06-21T10:58:03Z")

</div>

Hi,  
We're indexing and searching using account\_id as routing, in a cluster with  
3 nodes, things are working since 2 months ago, however now the routing  
defined on url  
is not matching with search result. This is the mapping for document type

> <https://gist.github.com/shairontoledo/9b5dd371bbf0715393ad>

When I search by

curl -XGET '  
[http://server:9200/prod/document/\_search?routing=427&fields=account\_id,\_routing&size=10&pretty=true](http://server:9200/prod/document/_search?routing=427&fields=account_id,_routing&size=10&pretty=true)'  
-d '  
{  
"query": {  
"bool": {  
"must": [  
{  
"term": {  
"type": "pdf"  
}  
}  
]  
}  
}  
}  
'

The result is [https://gist.github.com/b544c15b8a92e19d7413](https://gist.github.com/b544c15b8a92e19d7413) as you can see  
for 5 documents \_routing and account\_d match with routing in the url(427),  
5 others docs don't make part of the routing.

Worth mention that this began happen few days ago, I don't see anything in  
the ES log.

We're running 0.19.3, do you have any idea how can I fix that?

--

Shairon Toledo  
[http://hashcode.me](http://hashcode.me)

---

<div class="post-metadata">

**Author:** ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)\
**Post date:** [June 21, 2012, 11:14am UTC](https://discuss.elastic.co/t/routing-value-doesnt-match-with-search-result/8178/2 "2012-06-21T11:14:33Z")

</div>

Hello Shairon!

If you only want to have documents only for a particular account\_id, you should add a filter for that account\_id value apart from the routing value. The reason for the behavior you are seeing is that multiple routing values can point to the same shard. So if you want to narrow your search result you should use routing and filtering for account\_id.

_--_

Regards,

Rafał Kuć

Sematext :: [http://sematext.com/](http://sematext.com/) _:: Solr - Lucene - Nutch - ElasticSearch_

Hi,

We're indexing and searching using account\_id as routing, in a cluster with 3 nodes, things are working since 2 months ago, however now the routing defined on url

is not matching with search result. This is the mapping for document type [https://gist.github.com/9b5dd371bbf0715393ad](https://gist.github.com/9b5dd371bbf0715393ad)

When I search by

curl -XGET '[http://server:9200/prod/document/\_search?routing=427&fields=account\_id,\_routing&size=10&pretty=true](http://server:9200/prod/document/_search?routing=427&fields=account_id,_routing&size=10&pretty=true)' -d '

{

"query": {

```
"bool": {

  "must": [

    {

      "term": {

        "type": "pdf"

      }

    }

  ]

}

```

}

}

'

The result is [https://gist.github.com/b544c15b8a92e19d7413](https://gist.github.com/b544c15b8a92e19d7413) as you can see for 5 documents \_routing and account\_d match with routing in the url(427),

5 others docs don't make part of the routing.

Worth mention that this began happen few days ago, I don't see anything in the ES log.

We're running 0.19.3, do you have any idea how can I fix that?

--

Shairon Toledo

[http://hashcode.me](http://hashcode.me)

---

<div class="post-metadata">

**Author:** ![Shairon\_Toledo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shairon_toledo/32/2490_2.png) [@Shairon\_Toledo](https://discuss.elastic.co/u/Shairon_Toledo)\
**Post date:** [June 21, 2012, 11:20am UTC](https://discuss.elastic.co/t/routing-value-doesnt-match-with-search-result/8178/3 "2012-06-21T11:20:01Z")

</div>

Hi Rafal,

Yeap I did this hotfix yesterday, however I thought that routing is also I  
kind of filter scoping by document field level.

Thank you,

On Thu, Jun 21, 2012 at 8:14 AM, Rafał Kuć [r.kuc@solr.pl](mailto:r.kuc@solr.pl) wrote:

> Hello Shairon!
> 
> If you only want to have documents only for a particular account\_id, you  
> should add a filter for that account\_id value apart from the routing value.  
> The reason for the behavior you are seeing is that multiple routing values  
> can point to the same shard. So if you want to narrow your search result  
> you should use routing and filtering for account\_id.
> 
> \*--  
> Regards,  
> Rafał Kuć  
> Sematext :: _[http://sematext.com/](http://sematext.com/)_ :: Solr - Lucene - Nutch -  
> Elasticsearch
> 
> - 
> 
> Hi,  
> We're indexing and searching using account\_id as routing, in a cluster  
> with 3 nodes, things are working since 2 months ago, however now the  
> routing defined on url  
> is not matching with search result. This is the mapping for document type  
> [gist:9b5dd371bbf0715393ad · GitHub](https://gist.github.com/9b5dd371bbf0715393ad)
> 
> When I search by
> 
> curl -XGET '  
> [http://server:9200/prod/document/\_search?routing=427&fields=account\_id,\_routing&size=10&pretty=true](http://server:9200/prod/document/_search?routing=427&fields=account_id,_routing&size=10&pretty=true)'  
> -d '  
> {  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "term": {  
> "type": "pdf"  
> }  
> }  
> ]  
> }  
> }  
> }  
> '
> 
> The result is [gist:b544c15b8a92e19d7413 · GitHub](https://gist.github.com/b544c15b8a92e19d7413) as you can see  
> for 5 documents \_routing and account\_d match with routing in the url(427),  
> 5 others docs don't make part of the routing.
> 
> Worth mention that this began happen few days ago, I don't see anything in  
> the ES log.
> 
> We're running 0.19.3, do you have any idea how can I fix that?
> 
> --
> 
> Shairon Toledo  
> [http://hashcode.me](http://hashcode.me)

--

Shairon Toledo

> **[Microsoft Developer News | C++,C# & .NET Framework & More | CodeGuru](http://hashcode.me)**
>
> 您是否想要找关于幸运飞行艇 官方开奖历史记录 168飞艇全国统一开奖数据 还有幸运飞行艇官方开奖现场直播 幸运168飞艇全天精准稳定计划 这里都能一一提供。CodeGuru is where developers come to share ideas, articles, questions, answers, tips, tricks, comments, downloads, and more related to programming in areas including C++,...

---

<div class="post-metadata">

**Author:** ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)\
**Post date:** [June 21, 2012, 11:22am UTC](https://discuss.elastic.co/t/routing-value-doesnt-match-with-search-result/8178/4 "2012-06-21T11:22:45Z")

</div>

Hello!

No, it only routes the indexing and querying to a single shard, which can also have documents with other routing values.

_--_

Regards,

Rafał Kuć

Sematext :: [http://sematext.com/](http://sematext.com/) _:: Solr - Lucene - Nutch - ElasticSearch_

Hi Rafal,

Yeap I did this hotfix yesterday, however I thought that routing is also I kind of filter scoping by document field level.

Thank you,

On Thu, Jun 21, 2012 at 8:14 AM, Rafał Kuć \<[r.kuc@solr.pl](mailto:r.kuc@solr.pl)\> wrote:

Hello Shairon!

If you only want to have documents only for a particular account\_id, you should add a filter for that account\_id value apart from the routing value. The reason for the behavior you are seeing is that multiple routing values can point to the same shard. So if you want to narrow your search result you should use routing and filtering for account\_id.

_--_

Regards,

Rafał Kuć

Sematext :: [http://sematext.com/](http://sematext.com/) _:: Solr - Lucene - Nutch - ElasticSearch_

Hi,

We're indexing and searching using account\_id as routing, in a cluster with 3 nodes, things are working since 2 months ago, however now the routing defined on url

is not matching with search result. This is the mapping for document type [https://gist.github.com/9b5dd371bbf0715393ad](https://gist.github.com/9b5dd371bbf0715393ad)

When I search by

curl -XGET '[http://server:9200/prod/document/\_search?routing=427&fields=account\_id,\_routing&size=10&pretty=true](http://server:9200/prod/document/_search?routing=427&fields=account_id,_routing&size=10&pretty=true)' -d '

{

"query": {

```
"bool": {

  "must": [

    {

      "term": {

        "type": "pdf"

      }

    }

  ]

}

```

}

}

'

The result is [https://gist.github.com/b544c15b8a92e19d7413](https://gist.github.com/b544c15b8a92e19d7413) as you can see for 5 documents \_routing and account\_d match with routing in the url(427),

5 others docs don't make part of the routing.

Worth mention that this began happen few days ago, I don't see anything in the ES log.

We're running 0.19.3, do you have any idea how can I fix that?

--

Shairon Toledo

[http://hashcode.me](http://hashcode.me)

--

Shairon Toledo

[http://hashcode.me](http://hashcode.me)

---

<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, 3:23am UTC](https://discuss.elastic.co/t/routing-value-doesnt-match-with-search-result/8178/5 "2017-07-06T03:23:06Z")

</div>


