1

我正在使用 Elasticsearch JSON Mapping 作为

{
    "mappings": {
        "test": {
            "_routing": {
                "path": "harvestdate", 
                "required": true
            }, 
            "_source": {
                "enabled": false
            }, 
            "properties": {
                "infoid": {
                    "precision_step": "0", 
                    "store": "yes", 
                    "type": "long"
                }, 
                "productid": {
                    "index": "not_analyzed", 
                    "omit_norms": "true", 
                    "omit_term_freq_and_positions": "true", 
                    "store": "yes", 
                    "type": "string"
                }, 
                "saleid": {
                    "precision_step": "0", 
                    "store": "yes", 
                    "type": "long"
                }
            }
        }
    }
}
  1. 我使用索引作为 index1
  2. 我必须在 JSON 中添加一个新字段,它看起来像
    { "mappings": { "test": { "_routing": { "path": "harvestdate", "required": true }, "_source": { "enabled": false }, "properties": { "deal": { "index": "not_analyzed", "omit_norms": "true", "omit_term_freq_and_positions": "true", "store": "no", "type": "string" }, "infoid": { "precision_step": "0", "store": "yes", "type": "long" }, "productid": { "index": "not_analyzed", "omit_norms": "true", "omit_term_freq_and_positions": "true", "store": "yes", "type": "string" }, "saleid": { "precision_step": "0", "store": "yes", "type": "long" } } } } }

我正在尝试使用 Elasticsearch 和 Index(index1) 通过使用命令来更新此映射

curl -XPUT 'http://localhost:9200/index1/test/_mapping' -d  '{
    "mappings": {
        "test": {
            "_routing": {
                "path": "harvestdate", 
                "required": true
            }, 
            "_source": {
                "enabled": false
            }, 
            "properties": {
                "deal": {
                    "index": "not_analyzed", 
                    "omit_norms": "true", 
                    "omit_term_freq_and_positions": "true", 
                    "store": "no", 
                    "type": "string"
                }, 
                "infoid": {
                    "precision_step": "0", 
                    "store": "yes", 
                    "type": "long"
                }, 
                "productid": {
                    "index": "not_analyzed", 
                    "omit_norms": "true", 
                    "omit_term_freq_and_positions": "true", 
                    "store": "yes", 
                    "type": "string"
                }, 
                "saleid": {
                    "precision_step": "0", 
                    "store": "yes", 
                    "type": "long"
                }
            }
        }
    }
}' 

在检查映射时,映射未使用索引(索引 1)中的更新映射设置。这个卷曲或映射有什么错误?

提前致谢!

干杯!

4

1 回答 1

3

我认为你需要删除

"mappings": {

事物。从我读到的内容(不记得在哪里,但在弹性搜索邮件列表中,“映射”来自GET,但不应该在这里PUTing,并且 IIRC,他们想在下一个版本中做一些关于它的事情)。

于 2012-06-28T13:11:45.780 回答