I'm stumble upon Changing Mapping with Zero Downtime | Elastic blog post, however it's dated back in 2013.
I need to add mapping to existing index, what is the best way to approach this?
Thanks in advance.
I'm stumble upon Changing Mapping with Zero Downtime | Elastic blog post, however it's dated back in 2013.
I need to add mapping to existing index, what is the best way to approach this?
Thanks in advance.
Refer to the documentation here on the PUT mapping API:
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html
I guess, I'm doing something wrong, can't put my finger on it...
delete index:
$ curl -XDELETE 0:9200/test?pretty
{
"acknowledged" : true
}
$
create index:
$ curl -XPUT 0:9200/test?pretty
{
"acknowledged" : true,
"shards_acknowledged" : true
}
$
create dummy document:
$ curl -XPOST 0:9200/test/t?pretty -d '{ "price": 1 }'
{
"_index" : "test",
"_type" : "t",
"_id" : "AVi7cocPMoL1V0O0z0Lk",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"created" : true
}
$
get existing mapping:
$ curl -XGET 0:9200/test/_mapping?pretty
{
"test" : {
"mappings" : {
"t" : {
"properties" : {
"price" : {
"type" : "long"
}
}
}
}
}
}
$
putting mapping:
$ curl -XPUT 0:9200/test/_mapping/t?pretty -d '
{
"test" : {
"mappings" : {
"t" : {
"properties" : {
"price": {
"type": "integer"
}
}
}
}
}
}
'
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [test : {mappings={t={properties={price={type=integer}}}}}]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [test : {mappings={t={properties={price={type=integer}}}}}]"
},
"status" : 400
}
$
Please advice.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.