I am trying to create a dynamic mapping for objects like the following:
{ "product": { "productId": 99999, "manufacturerId": "A0001", "manufacturerCode": "A101LI", "name": "Test Product", "description": "Describe the product here.", "feature_details":{ "category": "Category1", "brand": "Brand Name" }, "feature_tpcerts":{ "certifiedPass": true, "levelCertified": 2 }, "feature_characteristics":{ "amount": 0.73, "location": 49464 } } } I would like the feature_* properties to be a nested type, which I have defined in the mapping below with the nested_feature template and it is working as expected. However, I also want to have each property in the nested object of the feature_*property to be multi_value with an additional facet property defined. I have tried the second nested_template template, but without any success.
{ "product" : { "_timestamp" : {"enabled" : true, "store": "yes" }, "dynamic_templates": [ { "nested_feature": { "match" : "feature_*", "mapping" : { "type" : "nested", "stored": "true" } } }, { "nested_template": { "match": "feature_*.*", "mapping": { "type": "multi_field", "fields": { "{name}": { "type": "{dynamic_type}", "index": "analyzed" }, "facet": { "type": "{dynamic_type}", "index": "not_analyzed" } } } } } ], "properties" : { "productId" : { "type" : "integer", "store" : "yes"}, "manufacturerId" : { "type" : "string", "store" : "yes", "index" : "analyzed"}, "manufacturer" : { "type" : "string", "store" : "yes", "index" : "not_analyzed"}, "manufacturerCode" : { "type" : "string", "store" : "yes"}, "name" : {"type" : "string", "store" : "yes"}, "description": {"type": "string", "index" : "analyzed"} } } } Unfortunately, the properties within the feature_* properties are created from another process and can be almost any name/value pair. Any suggestions on how to use a dynamic template to setup a property as nested as well as make each property within the nested object multi_field with an additional facet property?