Specify type in mapping for nested documents


(David Blado) #1

i'm experimenting w/ the nested mapping type and am looking a lots of
examples / blog posts and not seeing any way to specify core types for the
fields in nested documents -- am I missing something or is this not
possible?

Cheers,

David

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


(sina.tamanna) #2

You can use core types in nested fields of course. Here is an example that
hopefully will clear-up things:

"mappings": {
"my_index": {
"properties": {
"attributes": {
"type": "nested",
"dynamic": "false",
"properties": {
"attribute_id": {
"type": "long"
},
"attribute_name": {
"type": "string"
},
"attribute_values": {
"type": "string"
}
}
}
}
}
}

and notice that dynamic flag is set to false so no other extra field would
be added to the attributes field.

On Friday, November 8, 2013 1:00:29 AM UTC+1, David Blado wrote:

i'm experimenting w/ the nested mapping type and am looking a lots of
examples / blog posts and not seeing any way to specify core types for the
fields in nested documents -- am I missing something or is this not
possible?

Cheers,

David

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


(David Blado) #3

Thanks Sina

That's exactly what I was looking for!
On Nov 8, 2013 12:10 AM, sina.tamanna@gmail.com wrote:

You can use core types in nested fields of course. Here is an example that
hopefully will clear-up things:

"mappings": {
"my_index": {
"properties": {
"attributes": {
"type": "nested",
"dynamic": "false",
"properties": {
"attribute_id": {
"type": "long"
},
"attribute_name": {
"type": "string"
},
"attribute_values": {
"type": "string"
}
}
}
}
}
}

and notice that dynamic flag is set to false so no other extra field
would be added to the attributes field.

On Friday, November 8, 2013 1:00:29 AM UTC+1, David Blado wrote:

i'm experimenting w/ the nested mapping type and am looking a lots of
examples / blog posts and not seeing any way to specify core types for the
fields in nested documents -- am I missing something or is this not
possible?

Cheers,

David

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/qSNMLYVLyos/unsubscribe.
To unsubscribe from this group and all its topics, 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.


(system) #4