elasticsearch - dynamic mapping for nested type -


i have index/type of test1/all looks follows:

{   "test1": {      "mappings": {         "all": {            "properties": {               "colors": {                  "properties": {                     "h": {"type": "double"},                     "s": {"type": "long"},                     "v": {"type": "long"},                     "color_percent": {"type": "long"}                  }               },               "file_name": {                  "type": "string"               },               "id": {                  "type": "string"               },               "no_of_colors": {                  "type": "long"               }            }         }      }   } } 

i make colors field nested, trying following :

put /test1/all/_mapping  {   "mappings":{           "all":{               "properties": {                   "file_name":{                       "type": "string",                       "index": "not_analyzed"                   },                   "id": {                       "type": "string",                       "index": "not_analyzed"                   },                   "no_of_colors":{                   "type":"long",                   "index": "not_analyzed"                   },                   "colors":{                   "type":"nested",                   "properties":{                       "h":{"type":"double"},                       "s":{"type":"long"},                       "v":{"type":"long"},                       "color_percent":{"type":"integer"}                   }                   }               }                }      } } 

but following error:

{ "error": "mapperparsingexception[root type mapping not empty after parsing! remaining fields:   [mappings : {all={properties={file_name={type=string, index=not_analyzed}, id={type=string, index=not_analyzed}, no_of_colors={type=integer, index=not_analyzed}, colors={type=nested, properties={h={type=double}, s={type=long}, v={type=long}, color_percent={type=integer}}}}}}]]",  "status": 400 } 

any suggestions? appreciate help.

you're there, need remove mappings section this:

put /test1/all/_mapping {   "properties": {     "file_name": {       "type": "string",       "index": "not_analyzed"     },     "id": {       "type": "string",       "index": "not_analyzed"     },     "no_of_colors": {       "type": "long",       "index": "not_analyzed"     },     "colors": {       "type": "nested",       "properties": {         "h": {           "type": "double"         },         "s": {           "type": "long"         },         "v": {           "type": "long"         },         "color_percent": {           "type": "integer"         }       }     }   } } 

however, note not work either, because cannot change colors type object nested , other string fields analyzed _not_analyzed. need delete index , re-create scratch


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -