External routing and document path routing mismatch

Hi people,

I need you help to know what I'm doing wrong in this really simple
scenario, that I need to extrapolate afterwards to a rather big system
(about 50M docs in 20 shards).

I've configured the routing of documents on the server side, creating
the index and defining the mapping of an "Item" type as follows (based
on http://www.elasticsearch.org/guide/reference/mapping/routing-field.html)

$ curl -XPUT 'http://localhost:9200/items/' -d '{
"settings" : {
"index" : { "number_of_shards" : 2, "number_of_replicas" :
1 }
},
"mappings" : {
"item" : {
"_routing" : {
"required" : true,
"path" : "seller_id"
}
}
}
}'

But when I try to index an item, with the following request,
$curl -XPUT http://localhost:9200/items/item/123 -d
'{"id":"123","title":"A title","seller_id":19875421}'

I get the error
{"error":"MapperParsingException[External routing [19875421] and
document path routing [null] mismatch]","status":400}

Any ideas of what am I doing wrong? I've walkedt through part of the
code of ES, following the exception stack trace, but couldn't figure
out the origin of the problem.

Server stack trace:
org.elasticsearch.index.mapper.MapperParsingException: External
routing [19875421] and document path routing [null] mismatch
at
org.elasticsearch.index.mapper.internal.RoutingFieldMapper.validate(RoutingFieldMapper.java:
137)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
611)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
491)
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:
289)
at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:
185)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:
428)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:341)
....

Thanks in advance,
Frederic

it happens because the seller_id is a numeric value (and indexed
differently...). If you change it to be a string, it will work. You can open
an issue to fix it...

On Wed, Sep 7, 2011 at 4:39 PM, Frederic focampo.br@gmail.com wrote:

Hi people,

I need you help to know what I'm doing wrong in this really simple
scenario, that I need to extrapolate afterwards to a rather big system
(about 50M docs in 20 shards).

I've configured the routing of documents on the server side, creating
the index and defining the mapping of an "Item" type as follows (based
on Elasticsearch Platform — Find real-time answers at scale | Elastic
)

$ curl -XPUT 'http://localhost:9200/items/' -d '{
"settings" : {
"index" : { "number_of_shards" : 2, "number_of_replicas" :
1 }
},
"mappings" : {
"item" : {
"_routing" : {
"required" : true,
"path" : "seller_id"
}
}
}
}'

But when I try to index an item, with the following request,
$curl -XPUT http://localhost:9200/items/item/123 -d
'{"id":"123","title":"A title","seller_id":19875421}'

I get the error
{"error":"MapperParsingException[External routing [19875421] and
document path routing [null] mismatch]","status":400}

Any ideas of what am I doing wrong? I've walkedt through part of the
code of ES, following the exception stack trace, but couldn't figure
out the origin of the problem.

Server stack trace:
org.elasticsearch.index.mapper.MapperParsingException: External
routing [19875421] and document path routing [null] mismatch
at

org.elasticsearch.index.mapper.internal.RoutingFieldMapper.validate(RoutingFieldMapper.java:
137)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
611)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
491)
at

org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:
289)
at

org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:
185)
at

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction

$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:
428)
at

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:341)
....

Thanks in advance,
Frederic

Thanks a lot for your quick answer Kimchy.
I'll open the issue then, and try to index the value as string
meanwhile.

On 7 sep, 11:30, Shay Banon kim...@gmail.com wrote:

it happens because the seller_id is a numeric value (and indexed
differently...). If you change it to be a string, it will work. You can open
an issue to fix it...

On Wed, Sep 7, 2011 at 4:39 PM, Frederic focampo...@gmail.com wrote:

Hi people,

I need you help to know what I'm doing wrong in this really simple
scenario, that I need to extrapolate afterwards to a rather big system
(about 50M docs in 20 shards).

I've configured the routing of documents on the server side, creating
the index and defining the mapping of an "Item" type as follows (based
onhttp://www.elasticsearch.org/guide/reference/mapping/routing-field.html
)

$ curl -XPUT 'http://localhost:9200/items/'-d '{
"settings" : {
"index" : { "number_of_shards" : 2, "number_of_replicas" :
1 }
},
"mappings" : {
"item" : {
"_routing" : {
"required" : true,
"path" : "seller_id"
}
}
}
}'

But when I try to index an item, with the following request,
$curl -XPUThttp://localhost:9200/items/item/123-d
'{"id":"123","title":"A title","seller_id":19875421}'

I get the error
{"error":"MapperParsingException[External routing [19875421] and
document path routing [null] mismatch]","status":400}

Any ideas of what am I doing wrong? I've walkedt through part of the
code of ES, following the exception stack trace, but couldn't figure
out the origin of the problem.

Server stack trace:
org.elasticsearch.index.mapper.MapperParsingException: External
routing [19875421] and document path routing [null] mismatch
at

org.elasticsearch.index.mapper.internal.RoutingFieldMapper.validate(RoutingFieldMapper.java:
137)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
611)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
491)
at

org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:
289)
at

org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:
185)
at

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction

$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:
428)
at

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:341)
....

Thanks in advance,
Frederic