elasticsearch - Error when creating an index using mappings file -
i installed elasticsearch 1.5.2 on centos service. tried add mappings using put:
curl -xput $es_host/my_index -d' { "mappings": { "my_type": { "properties": { "field": { "type": "nested" } } } } }'
that request works fine , creates new index correct mappings. instead of putting mappings manually want store mappings on server in config files. created file /etc/elasticsearch/mappings/my_index/all_mappings.json
same content previous request body. after i'm trying create index curl -xput $es_host/my_index
error occurs
{ "error": "mapperparsingexception[mapping [all_mappings]]; nested: mapperparsingexception[root type mapping not empty after parsing! remaining fields: [mappings : {my_type={properties={field={type=nested}}}}]]; ", "status": 400 }
i tried remove mappings
field in config json nothing changed.
the name of file mapping name. so, /mappings/my_index/all_mappings.json
should have index my_index
, type
called all_mappings
.
also, content of file should be:
{ "properties": { "field": { "type": "nested" } } }
these being said, following:
- create
my_type.json
file under/etc/elasticsearch/mappings/my_index
folder - put inside file following:
{ "properties": { "field": { "type": "nested" } } }
- call
put /test_my_index
- check mapping:
get /test_my_index/_mapping
Comments
Post a Comment