ReplicationShardOperationFailedException when indexing document with heterogeneous array


(Alex Wajda) #1

Hi,

I'm trying to index the following JSON document with an array of
values of different types:

$ curl -XPUT http://localhost:9200/myidx/mytype/1 -d '
{
id:1,
heterogeneous_array: [
123,
"string value",
{content: "json value"}
]
}'

And here's what I get:

{"error":"ReplicationShardOperationFailedException[[myidx][0] ];
nested: MapperParsingException[Failed to parse [heterogeneous_array]];
nested: NumberFormatException[For input string: "string value"]; "}

[16:08:35,151][INFO ][cluster.metadata ] [Annie Ghazikhanian]
[myidx] creating index, cause [auto(index api)], shards [5]/[1],
mappings []
[16:08:35,710][DEBUG][action.index ] [Annie Ghazikhanian]
[myidx][0], node[87109fd6-40f4-4143-8ab2-062505eb5302], [P],
s[STARTED]: Failed to execute [[myidx][mytype][1], source[
{
id:1,
heterogeneous_array: [
123,
"string value",
{content: "json value"}
]
}]]
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[heterogeneous_array]
at
org.elasticsearch.index.mapper.xcontent.XContentFieldMapper.parse(XContentFieldMapper.java:
293)
at
org.elasticsearch.index.mapper.xcontent.XContentObjectMapper.serializeValue(XContentObjectMapper.java:
405)
at
org.elasticsearch.index.mapper.xcontent.XContentObjectMapper.serializeArray(XContentObjectMapper.java:
397)
at
org.elasticsearch.index.mapper.xcontent.XContentObjectMapper.parse(XContentObjectMapper.java:
330)
at
org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper.parse(XContentDocumentMapper.java:
336)
at
org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper.parse(XContentDocumentMapper.java:
288)
at
org.elasticsearch.index.shard.service.InternalIndexShard.innerIndex(InternalIndexShard.java:
233)
at
org.elasticsearch.index.shard.service.InternalIndexShard.index(InternalIndexShard.java:
225)
at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:
130)
at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:
57)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:
381)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.access
$400(TransportShardReplicationOperationAction.java:208)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:278)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NumberFormatException: For input string: "string
value"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:
48)
at java.lang.Long.parseLong(Long.java:410)
at java.lang.Long.parseLong(Long.java:468)
at
org.elasticsearch.common.xcontent.support.AbstractXContentParser.longValue(AbstractXContentParser.java:
68)
at
org.elasticsearch.index.mapper.xcontent.XContentLongFieldMapper.parseCreateField(XContentLongFieldMapper.java:
171)
at
org.elasticsearch.index.mapper.xcontent.XContentLongFieldMapper.parseCreateField(XContentLongFieldMapper.java:
49)
at
org.elasticsearch.index.mapper.xcontent.XContentFieldMapper.parse(XContentFieldMapper.java:
282)
... 15 more

Thank you!

BR, Alex.


(Thiago Souza) #2

Hello,

  I guess this isn't supported. As far as I know, all values of an array

must be of the same type.

Regards,
Thiago Souza

On Tue, Sep 21, 2010 at 11:11, Alex Wajda alexander.wajda@gmail.com wrote:

Hi,

I'm trying to index the following JSON document with an array of
values of different types:

$ curl -XPUT http://localhost:9200/myidx/mytype/1 -d '
{
id:1,
heterogeneous_array: [
123,
"string value",
{content: "json value"}
]
}'

And here's what I get:

{"error":"ReplicationShardOperationFailedException[[myidx][0] ];
nested: MapperParsingException[Failed to parse [heterogeneous_array]];
nested: NumberFormatException[For input string: "string value"]; "}

[16:08:35,151][INFO ][cluster.metadata ] [Annie Ghazikhanian]
[myidx] creating index, cause [auto(index api)], shards [5]/[1],
mappings []
[16:08:35,710][DEBUG][action.index ] [Annie Ghazikhanian]
[myidx][0], node[87109fd6-40f4-4143-8ab2-062505eb5302], [P],
s[STARTED]: Failed to execute [[myidx][mytype][1], source[
{
id:1,
heterogeneous_array: [
123,
"string value",
{content: "json value"}
]
}]]
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[heterogeneous_array]
at

org.elasticsearch.index.mapper.xcontent.XContentFieldMapper.parse(XContentFieldMapper.java:
293)
at

org.elasticsearch.index.mapper.xcontent.XContentObjectMapper.serializeValue(XContentObjectMapper.java:
405)
at

org.elasticsearch.index.mapper.xcontent.XContentObjectMapper.serializeArray(XContentObjectMapper.java:
397)
at

org.elasticsearch.index.mapper.xcontent.XContentObjectMapper.parse(XContentObjectMapper.java:
330)
at

org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper.parse(XContentDocumentMapper.java:
336)
at

org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper.parse(XContentDocumentMapper.java:
288)
at

org.elasticsearch.index.shard.service.InternalIndexShard.innerIndex(InternalIndexShard.java:
233)
at

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

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

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

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction

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

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.access
$400(TransportShardReplicationOperationAction.java:208)
at

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:278)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NumberFormatException: For input string: "string
value"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:
48)
at java.lang.Long.parseLong(Long.java:410)
at java.lang.Long.parseLong(Long.java:468)
at

org.elasticsearch.common.xcontent.support.AbstractXContentParser.longValue(AbstractXContentParser.java:
68)
at

org.elasticsearch.index.mapper.xcontent.XContentLongFieldMapper.parseCreateField(XContentLongFieldMapper.java:
171)
at

org.elasticsearch.index.mapper.xcontent.XContentLongFieldMapper.parseCreateField(XContentLongFieldMapper.java:
49)
at

org.elasticsearch.index.mapper.xcontent.XContentFieldMapper.parse(XContentFieldMapper.java:
282)
... 15 more

Thank you!

BR, Alex.


(Shay Banon) #3

Yea, they have to be of the same type... .

On Tue, Sep 21, 2010 at 7:35 PM, Thiago Souza tcostasouza@gmail.com wrote:

Hello,

  I guess this isn't supported. As far as I know, all values of an

array must be of the same type.

Regards,
Thiago Souza

On Tue, Sep 21, 2010 at 11:11, Alex Wajda alexander.wajda@gmail.comwrote:

Hi,

I'm trying to index the following JSON document with an array of
values of different types:

$ curl -XPUT http://localhost:9200/myidx/mytype/1 -d '
{
id:1,
heterogeneous_array: [
123,
"string value",
{content: "json value"}
]
}'

And here's what I get:

{"error":"ReplicationShardOperationFailedException[[myidx][0] ];
nested: MapperParsingException[Failed to parse [heterogeneous_array]];
nested: NumberFormatException[For input string: "string value"]; "}

[16:08:35,151][INFO ][cluster.metadata ] [Annie Ghazikhanian]
[myidx] creating index, cause [auto(index api)], shards [5]/[1],
mappings []
[16:08:35,710][DEBUG][action.index ] [Annie Ghazikhanian]
[myidx][0], node[87109fd6-40f4-4143-8ab2-062505eb5302], [P],
s[STARTED]: Failed to execute [[myidx][mytype][1], source[
{
id:1,
heterogeneous_array: [
123,
"string value",
{content: "json value"}
]
}]]
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[heterogeneous_array]
at

org.elasticsearch.index.mapper.xcontent.XContentFieldMapper.parse(XContentFieldMapper.java:
293)
at

org.elasticsearch.index.mapper.xcontent.XContentObjectMapper.serializeValue(XContentObjectMapper.java:
405)
at

org.elasticsearch.index.mapper.xcontent.XContentObjectMapper.serializeArray(XContentObjectMapper.java:
397)
at

org.elasticsearch.index.mapper.xcontent.XContentObjectMapper.parse(XContentObjectMapper.java:
330)
at

org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper.parse(XContentDocumentMapper.java:
336)
at

org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper.parse(XContentDocumentMapper.java:
288)
at

org.elasticsearch.index.shard.service.InternalIndexShard.innerIndex(InternalIndexShard.java:
233)
at

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

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

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

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction

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

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.access
$400(TransportShardReplicationOperationAction.java:208)
at

org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:278)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NumberFormatException: For input string: "string
value"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:
48)
at java.lang.Long.parseLong(Long.java:410)
at java.lang.Long.parseLong(Long.java:468)
at

org.elasticsearch.common.xcontent.support.AbstractXContentParser.longValue(AbstractXContentParser.java:
68)
at

org.elasticsearch.index.mapper.xcontent.XContentLongFieldMapper.parseCreateField(XContentLongFieldMapper.java:
171)
at

org.elasticsearch.index.mapper.xcontent.XContentLongFieldMapper.parseCreateField(XContentLongFieldMapper.java:
49)
at

org.elasticsearch.index.mapper.xcontent.XContentFieldMapper.parse(XContentFieldMapper.java:
282)
... 15 more

Thank you!

BR, Alex.


(system) #4