I am hitting same issue with 2 shards

curl "localhost:9200/codeindexroute/_settings?pretty"
{
  "codeindexroute" : {
    "settings" : {
      "index" : {
        "index" : {
          "refresh_interval" : "-1"
        },
        "refresh_interval" : "1000",
        "number_of_shards" : "2",
        "number_of_replicas" : "0",
        "version" : {
          "created" : "1020099"
        },
        "uuid" : "p_8eAj0GSA-XNUWtQD6fLg"
      }
    }
  }
}

Now I index the document 

curl "localhost:9200/codeindexroute/filecontracts/?routing=abc" -d 
@data-file.json
{"_index":"codeindexroute","_type":"filecontracts","_id":"n8-pLUU4TnS6LvhCDFIXkQ
","_version":1,"created":true}

curl "localhost:9200/codeindexroute/filecontracts/_search?routing=bbb"
{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hit
s":{"total":1,"max_score":1.0,"hits":[{"_index":"codeindexroute","_type":"fileco
ntracts","_id":"n8-pLUU4TnS6LvhCDFIXkQ","_score":1.0,"_source":{       
 "content
":"I am Happy", "contentid": "abcdedf", "filepath" : "\\test1\test1.txt",
"parsertype" : "txt"}}]}}


IMHO If hash collision is an issue then routing cannot be used at all and 
it is not useful.It has to be definite

On Monday, June 30, 2014 5:19:40 PM UTC+5:30, Himanshu Agrawal wrote:
>
> The way elasticsearch routing works is that it hashes the string value 
> provided by you to find the shard which contains the document. If you have 
> less number of shards there is a high probability of collision between 
> routing values such that they point to the same shard.
>
> Can you try with different values? Also post the output you get when you 
> try these requests with multiple shards.
>
>
> On Mon, Jun 30, 2014 at 5:04 PM, satishmallik <[email protected] 
> <javascript:>> wrote:
>
>> Hi Himanshu,
>> Thnaks for your response. I have single shard in my setup. But as per ES 
>> documents single shard can contain multiple routes. So route and Shard 
>> don't have 1:1 mapping.
>> I tested it on an index with multiple shards. But I am facing same issue,
>>
>> Regards
>> Satish
>>
>>
>> On Monday, June 30, 2014 2:17:25 PM UTC+5:30, Himanshu Agrawal wrote:
>>
>>> Hi Satish,
>>>
>>> From the requests and responses you have posted it seems that you only 
>>> have a single shard for the index "codeindexroute". Now routing doesn't 
>>> make sense when you have a single shard for an index because the request 
>>> will be executed on the same shard irrespective of the routing value 
>>> provided. That is why you are getting your document even after entering a 
>>> different value for routing. 
>>>
>>> Thanks,
>>> Himanshu.
>>>
>>>
>>> On Mon, Jun 30, 2014 at 12:36 PM, satishmallik <[email protected]> 
>>> wrote:
>>>
>>>> Still waiting for a response from ES team,
>>>>
>>>>
>>>> On Sunday, June 22, 2014 6:35:33 PM UTC+5:30, satishmallik wrote:
>>>>>
>>>>> I have following ES mapping defined,
>>>>>
>>>>> curl "localhost:9200/codeindexroute/filecontracts/_mapping"
>>>>>
>>>>> {
>>>>>  "codeindexroute":{
>>>>> "mappings":{
>>>>>  "filecontracts":{
>>>>> "_routing":{
>>>>>  "required":true
>>>>>  },
>>>>> "_source":{
>>>>> "compress":false,
>>>>>  "includes":["filePath","parserType"],
>>>>> "excludes":["content"]
>>>>>  },
>>>>> "properties":{
>>>>> "content":{
>>>>>  "type":"string",
>>>>> "term_vector":"with_positions_offsets"
>>>>>  },
>>>>> "contentID":{
>>>>> "type":"string",
>>>>>  "index":"not_analyzed"
>>>>> },
>>>>>  "filePath":{
>>>>> "type":"string",
>>>>>  "index":"no",
>>>>> "store":true
>>>>>  },
>>>>> "parserType":{
>>>>> "type":"string",
>>>>>  "index":"not_analyzed"
>>>>> }
>>>>>  }
>>>>> }
>>>>> }
>>>>>  }
>>>>> }
>>>>>
>>>>> I index the doc with routing ID "abc",
>>>>>
>>>>> curl "localhost:9200/codeindexroute/filecontracts/?routing=abc" -d 
>>>>> @data-file.json
>>>>>
>>>>>  {"_index":"codeindexroute","_type":"filecontracts","_id":"6A
>>>>> OXcDl4TLWgyUnXlDUcww
>>>>> ","_version":1,"created":true}
>>>>>
>>>>>
>>>>> data-file.json looks as follows
>>>>>
>>>>> {
>>>>> "content":"I am Happy",
>>>>>  "contentid": "abcdedf",
>>>>> "filepath" : "\\test1\test1.txt",
>>>>>  "parsertype" : "txt"
>>>>> }
>>>>>
>>>>>  When I look at all contents
>>>>>
>>>>> curl "localhost:9200/codeindexroute/filecontracts/_search?pretty"
>>>>>
>>>>> {
>>>>>   "took" : 53,
>>>>>   "timed_out" : false,
>>>>>   "_shards" : {
>>>>>     "total" : 1,
>>>>>     "successful" : 1,
>>>>>     "failed" : 0
>>>>>   },
>>>>>   "hits" : {
>>>>>     "total" : 1,
>>>>>     "max_score" : 1.0,
>>>>>     "hits" : [ {
>>>>>       "_index" : "codeindexroute",
>>>>>       "_type" : "filecontracts",
>>>>>       "_id" : "6AOXcDl4TLWgyUnXlDUcww",
>>>>>       "_score" : 1.0,
>>>>>       "_source":{}
>>>>>     } ]
>>>>>   }
>>>>> }
>>>>>
>>>>>
>>>>> curl "localhost:9200/codeindexroute/filecontracts/_search?routing=bbb"
>>>>>
>>>>> {"took":63,"timed_out":false,"_shards":{"total":1,"successfu
>>>>> l":1,"failed":0},"hi
>>>>> ts":{"total":1,"max_score":1.0,"hits":[{"_index":"codeindexr
>>>>> oute","_type":"filec
>>>>>  ontracts","_id":"6AOXcDl4TLWgyUnXlDUcww","_score":1.0,"_
>>>>> source":{}}]}}
>>>>>
>>>>>
>>>>> When I am searching with routing "bbb", Ideally it should not return 
>>>>> any document as I have not indexed any document with this routing ID. I 
>>>>> have just indexed one document with routing id "abc".
>>>>>
>>>>> Am I making some mistake here or, is there any issue with ES? Please 
>>>>> have a look, 
>>>>>
>>>>  -- 
>>>> 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 [email protected].
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/elasticsearch/2b1a7219-a651-4802-a873-cc43ca191f4b%
>>>> 40googlegroups.com 
>>>> <https://groups.google.com/d/msgid/elasticsearch/2b1a7219-a651-4802-a873-cc43ca191f4b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/8c88eb28-cb46-4ee0-878f-fdc6b79c761b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/8c88eb28-cb46-4ee0-878f-fdc6b79c761b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/f797d066-cd54-4927-9fe2-dbd945034c79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to