Mapping for nested object with dynamic keys, uniform values

Hi all,

I have a specific question about mapping definitions that I think will help
with my understanding of mapping more generally. Suppose I have a document
that looks something like the following:

{
"doc" : {
"nested_map": {
"key1": { /* obj1 / },
"key2": { /
obj2 */ },
...
},
// Other fields...
}
}

Suppose further that the key space for the nested_map is dynamic /
potentially unbounded (and isn't necessarily "nicely" named, such as
matchable by a regex), but the corresponding values all have the same
structure. I'd like to provide a mapping definition that tightly controls
the interpretation of those values (eg, obj1, obj2). How do I do so, given
that the actual field names for those objects are unknown?

Intuitively, I want to say something along the lines of "all fields of any
name in this (non-root) object should get the same object mapping." What is
the best way to express that?

Thanks very much,
Carl

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

Not sure I fully understand your use case.

May be default mapping is the feature you are looking for?
See http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping/

Does it help? If not, could you send some doc samples?

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

Le 11 mai 2013 à 04:08, Carl C carl@siftscience.com a écrit :

Hi all,

I have a specific question about mapping definitions that I think will help with my understanding of mapping more generally. Suppose I have a document that looks something like the following:

{
"doc" : {
"nested_map": {
"key1": { /* obj1 / },
"key2": { /
obj2 */ },
...
},
// Other fields...
}
}

Suppose further that the key space for the nested_map is dynamic / potentially unbounded (and isn't necessarily "nicely" named, such as matchable by a regex), but the corresponding values all have the same structure. I'd like to provide a mapping definition that tightly controls the interpretation of those values (eg, obj1, obj2). How do I do so, given that the actual field names for those objects are unknown?

Intuitively, I want to say something along the lines of "all fields of any name in this (non-root) object should get the same object mapping." What is the best way to express that?

Thanks very much,
Carl

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.

Not sure exactly how complicated your document structure is, but you can
start of by having a dynamic template where the path_match field is the
name of the nested object: "path_match": "nested_map". You can then break
things down by type.

--
Ivan

On Fri, May 10, 2013 at 7:08 PM, Carl C carl@siftscience.com wrote:

Hi all,

I have a specific question about mapping definitions that I think will
help with my understanding of mapping more generally. Suppose I have a
document that looks something like the following:

{
"doc" : {
"nested_map": {
"key1": { /* obj1 / },
"key2": { /
obj2 */ },
...
},
// Other fields...
}
}

Suppose further that the key space for the nested_map is dynamic /
potentially unbounded (and isn't necessarily "nicely" named, such as
matchable by a regex), but the corresponding values all have the same
structure. I'd like to provide a mapping definition that tightly controls
the interpretation of those values (eg, obj1, obj2). How do I do so, given
that the actual field names for those objects are unknown?

Intuitively, I want to say something along the lines of "all fields of any
name in this (non-root) object should get the same object mapping." What is
the best way to express that?

Thanks very much,
Carl

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

I have a similar problem. I have json documents coming out of a couchdb
which are composed of varying layers of nesting, with variable keys, but
static structure. I know whenever it is an array it will be an array of
objects, whenever elastic identifies something as 'dynamic', I want these
to be set instead to nested.

-John

On Saturday, May 11, 2013 4:56:02 PM UTC-7, Ivan Brusic wrote:

Not sure exactly how complicated your document structure is, but you can
start of by having a dynamic template where the path_match field is the
name of the nested object: "path_match": "nested_map". You can then break
things down by type.

Elasticsearch Platform — Find real-time answers at scale | Elastic

--
Ivan

On Fri, May 10, 2013 at 7:08 PM, Carl C <ca...@siftscience.com<javascript:>

wrote:

Hi all,

I have a specific question about mapping definitions that I think will
help with my understanding of mapping more generally. Suppose I have a
document that looks something like the following:

{
"doc" : {
"nested_map": {
"key1": { /* obj1 / },
"key2": { /
obj2 */ },
...
},
// Other fields...
}
}

Suppose further that the key space for the nested_map is dynamic /
potentially unbounded (and isn't necessarily "nicely" named, such as
matchable by a regex), but the corresponding values all have the same
structure. I'd like to provide a mapping definition that tightly controls
the interpretation of those values (eg, obj1, obj2). How do I do so, given
that the actual field names for those objects are unknown?

Intuitively, I want to say something along the lines of "all fields of
any name in this (non-root) object should get the same object mapping."
What is the best way to express that?

Thanks very much,
Carl

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