Dynamic template - treat objects as strings?


Is there a dynamic_template setting, or a dynamic/object setting that can
for type "object" be indexed as a searchable string blob?

Our structure looks like this:

"doc_type": "foo",
"date_received": "2013-01-01", # mapped as date
"form": {
"username": "dan",
"timestart": "2013-01-01 11:58:00", #mapped as date
"timeend": "2013-01-01 11:59:00", #mapped as date,
"prop1": "lala",
"prop2": "dada",
"prop3": {
"suba": "something",
"subb": "anything",

The issue with our data is that due to the it being user defined document
structures, we don't know if someone will create "prop3" as a string or a
date, or a mapping.

We've set date_detection to False, but the possible nested objects have
prevented us from indexing unknown properties (we have a common, system
defined index for our known properties)

What we're wondering is can the dynamic_template work to:

1: store objects like form.prop3 as a searchable string (knowing full well
that it'd be difficult to search)

2: if we set store=True, can we ensure that form.prop3 will be in its
original json format and not stringified?

My attempt at the dynamic template:

"dynamic_templates": [
"object_fields": {
"match": "form.*",
"match_mapping_type": "object",
"mapping": {
"type": "string"
doesn't seem to pick up any of the properties despite the mapping being set
to dynamic=true for the form property.

Is what I'm asking for possible?



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.