Multi-valued field with properties issue

Is it possible to have a mapping for a field that is both multi-valued and
has properties? If I have a title field and I want to support both language
specific and non-language specific versions of the field

{
"book" :{
"title": {
"type":"multi_field",
"fields":{
"title":{
"type": "string",
"index": "analyzed"
},
"untouched":{
"type": "string",
"index": "not_analyzed",
}
}
"properties":{
"en":{
"type": "multi_field",
"fields": {
"en": {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}

I want be able to index both documents below with the above mapping.

This works OK.

{
"book":{
"description": "Enterprise Search"
}
}

This fails with {"error":"MapperParsingException[failed to parse
[description]]; nested: Elastic
SearchIllegalArgumentException[unknown property [en]]; ","status":400}

{
"book":{
"description": {
"en":"Enterprise Search"
}
}
}

--
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.

I have not looked at the mapping, but judging from your examples, it seems
like you want book.description to be both a string or an object type. I
would rethink your data model since the current structure is confusing not
only during indexing (is it a string or an object?) but also during
searching. What is the output for a search on the book.description field if
it is an object?

You can have various multi fields on the same field (normal, untouched, en)
or have another field parallel to description, such as description_en.
Multilingual is tough!

Cheers,

Ivan

--
Ivan

On Tue, Aug 27, 2013 at 4:36 AM, dan dan.tuffery@gmail.com wrote:

Is it possible to have a mapping for a field that is both multi-valued and
has properties? If I have a title field and I want to support both language
specific and non-language specific versions of the field

{
"book" :{
"title": {
"type":"multi_field",
"fields":{
"title":{
"type": "string",
"index": "analyzed"
},
"untouched":{
"type": "string",
"index": "not_analyzed",
}
}
"properties":{
"en":{
"type": "multi_field",
"fields": {
"en": {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}

I want be able to index both documents below with the above mapping.

This works OK.

{
"book":{
"description": "Enterprise Search"
}
}

This fails with {"error":"MapperParsingException[failed to parse
[description]]; nested: Elastic
SearchIllegalArgumentException[unknown property [en]]; ","status":400}

{
"book":{
"description": {
"en":"Enterprise Search"
}
}
}

--
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.

Hi Ivan, thanks for your response.

--What is the output for a search on the book.description field if it is an
object?

I have some logic that will map it to a string or object depending what is
returned in the results.

Searching with this mapping shouldn't be an issue. if I want to search on
the string version of description I can just use 'description', if the user
has provided a language, say 'en', i can search on 'description.en'.

The only problem I am facing is indexing a language sensitive field with my
mapping.

On Tuesday, August 27, 2013 7:00:09 PM UTC+1, Ivan Brusic wrote:

I have not looked at the mapping, but judging from your examples, it seems
like you want book.description to be both a string or an object type. I
would rethink your data model since the current structure is confusing not
only during indexing (is it a string or an object?) but also during
searching. What is the output for a search on the book.description field if
it is an object?

You can have various multi fields on the same field (normal, untouched,
en) or have another field parallel to description, such as description_en.
Multilingual is tough!

Cheers,

Ivan

--
Ivan

On Tue, Aug 27, 2013 at 4:36 AM, dan <dan.t...@gmail.com <javascript:>>wrote:

Is it possible to have a mapping for a field that is both multi-valued
and has properties? If I have a title field and I want to support both
language specific and non-language specific versions of the field

{
"book" :{
"title": {
"type":"multi_field",
"fields":{
"title":{
"type": "string",
"index": "analyzed"
},
"untouched":{
"type": "string",
"index": "not_analyzed",
}
}
"properties":{
"en":{
"type": "multi_field",
"fields": {
"en": {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}

I want be able to index both documents below with the above mapping.

This works OK.

{
"book":{
"description": "Enterprise Search"
}
}

This fails with {"error":"MapperParsingException[failed to parse
[description]]; nested: Elastic
SearchIllegalArgumentException[unknown property [en]]; ","status":400}

{
"book":{
"description": {
"en":"Enterprise Search"
}
}
}

--
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:>.
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.