Elasticsearch : Root mapping definition has unsupported parameters index : not_analyzed -


hi trying create schema test.

put /test { "mappings": {             "field1":{                    "type":"integer"              },              "field2":{                    "type":"integer"              },               "field3":{                   "type":"string",                 "index":"not_analyzed"              },               "field4,":{                 "type":"string",               "analyzer":"autocomplete",               "search_analyzer":"standard"            }            }, "settings": {             bla             bla             bla             } 

i getting following error

            {               "error": {                 "root_cause": [                   {                     "type": "mapper_parsing_exception",                     "reason": "root mapping definition has unsupported parameters:  [index : not_analyzed] [type : string]"                   }                 ],                 "type": "mapper_parsing_exception",                 "reason": "failed parse mapping [featured]: root mapping definition has unsupported parameters:  [index : not_analyzed] [type : string]",                 "caused_by": {                   "type": "mapper_parsing_exception",                   "reason": "root mapping definition has unsupported parameters:  [index : not_analyzed] [type : string]"                 }               },               "status": 400             } 

please me resolve error

you're here, you're missing few things:

put /test {   "mappings": {     "type_name": {                <--- add type name       "properties": {             <--- enclose field definitions in "properties"         "field1": {           "type": "integer"         },         "field2": {           "type": "integer"         },         "field3": {           "type": "string",           "index": "not_analyzed"         },         "field4,": {           "type": "string",           "analyzer": "autocomplete",           "search_analyzer": "standard"         }       }     }   },   "settings": {      ...   } } 

update

if index exists, can modify mappings this:

put test/_mapping/type_name {     "properties": {             <--- enclose field definitions in "properties"         "field1": {           "type": "integer"         },         "field2": {           "type": "integer"         },         "field3": {           "type": "string",           "index": "not_analyzed"         },         "field4,": {           "type": "string",           "analyzer": "autocomplete",           "search_analyzer": "standard"         }     } } 

Comments