Setting type 'array' as object type

Hi,
I'd like to be able to set index mapping for accepting documents such as the one below.
not sure what type I should declare the 'products' field to be.
setting 'type':'array' doesn't validate(fails on mapping) and setting it as 'type':'object ' doesn't accept the this document structure (fails on indexing):

MapperParsingException[object mapping [segments] trying to serialize a value with no field associated with it, current value [123]]

Any idea what's the right configuration I should use here?

*I'm able to insert the document without mapping but I've to have it with mapping because the event type needs to be set as nested..

mapping:
'{
"user": {
"_ttl": {
"enabled": true
},
"properties": {
"events": {
"type": "nested",
"properties": {
"event_time": {
"type": "Date"
},
"products": {
"type": "array" , //(or 'object)
"index": "not_analyzed"
}
}
}
}
}
}'

document:
{
"id": "1",
"events": [{
"date": "2013-11-04",
"products": ["123","234","AA345"]
},
{
"date": "2013-11-04",
"products": ["123","234","BB345"]
}]
}

Could you gist a full curl recreation?

Note that you are using date field name instead of event_type but this is another story!

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 4 nov. 2013 à 18:15, oreno oreno@exelate.com a écrit :

Hi,
I'd like to be able to set index mapping for accepting documents such as the
one below.
not sure what type I should declare the 'products' field to be.
setting 'type':'array' doesn't validate(fails on mapping) and setting it as
'type':'object ' doesn't accept the this document structure (fails on
indexing):

MapperParsingException[object mapping [segments] trying to serialize a value
with no field associated with it, current value [123]]

Any idea what's the right configuration I should use here?

*I'm able to insert the document without mapping but I've to have it with
mapping because the event type needs to be set as nested..

mapping:
'{
"user": {
"_ttl": {
"enabled": true
},
"properties": {
"events": {
"type": "nested",
"properties": {
"event_time": {
"type": "Date"
},
"products": {
"type": "array" , //(or 'object)
"index": "not_analyzed"
}
}
}
}
}
}'

document:
{
"id": "1",
"events": [{
"date": "2013-11-04",
"products": ["123","234","AA345"]
},
{
"date": "2013-11-04",
"products": ["123","234","BB345"]
}]
}

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/setting-type-array-as-object-type-tp4043714.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.