How to map a field inside an object in elastic search

I have a template mapping like below.

  {
    	"order": 0,
    	"index_patterns": [
    		"*xyz_foundation*"
    	],
    	"settings": {
    		"index": {
    			"number_of_shards": "6",
    			"number_of_replicas": "1"
    		},
    		"index.mapping.ignore_malformed": true
    	},
    	"mappings": {
    		"_doc": {
    			"dynamic_templates": [{
    					"imx_integer": {
    						"path_match": "imx.imResponse.policy_score*",
    						"match_mapping_type": "string",
    						"mapping": {
    							"type": "float"
    						}
    					},
				        {
            "string_fields": {
              "match": "*",
              "match_mapping_type": "string",
              "mapping": {
                "type": "keyword"
              }
            }
          }
    				}
              ],
    			"properties": {
    				"xyz": {
    					"properties": {
    					"VER_NO": {
     							"type": "keyword"

     						}
    					}
    				},
    				"imx": {
                          "type": "object"
    				}
                   }
    		}
    	},
    	"aliases": {
    		"xyz_foundation": {}
}}

the imx object can contain objects and n number of fields , so I broadly defined it as object and defined match string as keyword in dynamic template.

now I have a new field called "imx.imResponse.policy_score" which must be considered as float. I defined the mapping inside dynamic template section as in above template.
how can I define mapping for "imx.imResponse.policy_score" as float in a better way..? can I define it inside imx object..?

thanks for reading and helping.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.