1

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

コマンドを使用して、インデックス(index1)でElasticsearchを使用してこのマッピングを更新しようとしています

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) に更新されたマッピングが設定されていません。このカールまたはマッピングのエラーは何ですか?

前もって感謝します!

乾杯!

4

1 に答える 1

3

を削除する必要があると思います

"mappings": {

もの。私が読んだことから(どこを覚えていませんが、エラスティックサーチメーリングリストでは、「マッピング」はから来ていますが、IIRCが次のバージョンで何かをしたいGETときはここにあるべきではありません)。PUTing

于 2012-06-28T13:11:45.780 に答える