【问题标题】:Elasticsearch adding new fields showing Error in ElasticsearchElasticsearch 添加新字段显示 Elasticsearch 中的错误
【发布时间】:2012-06-28 12:22:15
【问题描述】:

我使用 Elasticsearch JSON 映射作为

{
    "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"
                }
            }
        }
    }
}' 

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

提前致谢!

干杯!

【问题讨论】:

  • 我不明白为什么第二个块不想正确缩进......

标签: elasticsearch


【解决方案1】:

我认为你需要删除

"mappings": {

东西。从我读到的(不记得在哪里,但在弹性搜索邮件列表中,“映射”来自GET,但当PUTing 和 IIRC 时不应该在这里,他们想在接下来做点什么关于它的版本)。

【讨论】:

  • 我尝试删除“映射”:{ .... } 我收到以下错误...
  • 我尝试删除“映射”:{ .... } 我收到以下错误... >
猜你喜欢
  • 2017-04-21
  • 2018-03-29
  • 1970-01-01
  • 1970-01-01
  • 2017-01-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-09
相关资源
最近更新 更多