Routing not working for ES

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":"6AOXcDl4TLWgyUnXlDUcww
","_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,"successful":1,"failed":0},"hi
ts":{"total":1,"max_score":1.0,"hits":[{"_index":"codeindexroute","_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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/83b7ac11-236e-483b-a248-221e09359755%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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":"6AOXcDl4TLWgyUnXlDUcww
","_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,"successful":1,"failed":0},"hi

ts":{"total":1,"max_score":1.0,"hits":[{"_index":"codeindexroute","_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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2b1a7219-a651-4802-a873-cc43ca191f4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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 satishmallik@gmail.com
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":"
6AOXcDl4TLWgyUnXlDUcww
","_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,"
successful":1,"failed":0},"hi
ts":{"total":1,"max_score":1.0,"hits":[{"_index":"
codeindexroute","_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 elasticsearch+unsubscribe@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CACTSS%3D7%3D9htH%2BpzQC7hU0r-spRiY%2B%2B-kpHOLe5%2BQpnKS7zimpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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 <satish...@gmail.com
<javascript:>> 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":"
6AOXcDl4TLWgyUnXlDUcww
","_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,"
successful":1,"failed":0},"hi
ts":{"total":1,"max_score":1.0,"hits":[{"_index":"
codeindexroute","_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 elasticsearc...@googlegroups.com <javascript:>.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8c88eb28-cb46-4ee0-878f-fdc6b79c761b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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 satishmallik@gmail.com
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 satish...@gmail.com
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 elasticsearc...@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CACTSS%3D79V9LnbdMVfkvhytJHE%3DOXXmKSZxvk7kaoFrdr%3DaBs3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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 <satish...@gmail.com
<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 satish...@gmail.com
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 elasticsearc...@googlegroups.com.
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 elasticsearc...@googlegroups.com <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 elasticsearch+unsubscribe@googlegroups.com.
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.

Elasticsearch routing is definite and collision is not an issue. I think
you don't understand the purpose of routing. The routing only decides the
shard on which search query would be executed. So essentially both of your
queries are being executed on the same shard because both the routing
values points to the same shard. Routing will not filter the results from a
shard even if they were indexed through different routing values. If you
want to filter these document you have to use search filters.
On Jun 30, 2014 6:54 PM, "satishmallik" satishmallik@gmail.com wrote:

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 satish...@gmail.com
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 satish...@gmail.com
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,"_sour
ce":{}}]}}

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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/2b1a7219-a651-4802-a873-cc43ca191f4b%40goo
glegroups.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 elasticsearc...@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/f797d066-cd54-4927-9fe2-dbd945034c79%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/f797d066-cd54-4927-9fe2-dbd945034c79%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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CACTSS%3D6MWxL%3Dqpk6f%3Di_fdbs40ZetgEjB6ac96jYHn3UtVDMXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Still waiting for a response from ES team for this issue.

On Monday, June 30, 2014 6:41:55 PM UTC+5:30, satishmallik wrote:

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 satish...@gmail.com
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 satish...@gmail.com
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 elasticsearc...@googlegroups.com.
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 elasticsearc...@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/609d33bc-4ac7-45af-8646-6537bc483c7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

FYI this is a community mailing list, not a SLA based support channel.
If you are patient someone will answer when they can spare some time.

Regards,
Mark Walkom

Infrastructure Engineer
Campaign Monitor
email: markw@campaignmonitor.com
web: www.campaignmonitor.com

On 1 July 2014 17:30, satishmallik satishmallik@gmail.com wrote:

Still waiting for a response from ES team for this issue.

On Monday, June 30, 2014 6:41:55 PM UTC+5:30, satishmallik wrote:

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 satish...@gmail.com
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 satish...@gmail.com
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,"_sour
ce":{}}]}}

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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/2b1a7219-a651-4802-a873-cc43ca191f4b%40goo
glegroups.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 elasticsearc...@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/609d33bc-4ac7-45af-8646-6537bc483c7f%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/609d33bc-4ac7-45af-8646-6537bc483c7f%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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAEM624YgTAOLqFOWcNAg%2Bu3%2B%2BmJHMPj0wKFxs%2BUCKGLE74Sb4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.