2016-03-20 13 views
0

アムtryningをelasticsearchは、使用してオートコンプリートを作るためにmongoosastic I次のコードを持っている:私は、このエラーメッセージ提案者完了mongoosastic 4.xの持つ問題と2.2

を[持っマッピング中

var ItemSchema = new Schema({ 
    label: { 
     type: String, 
     required: true, 
     es_type: "completion", 
     es_analyzer: "simple", 
     es_payloads: true 
    }) 

ItemSchema.plugin(mongoosastic); 

var ITEM = mongoose.model('Item', ItemSchema); 

ITEM.createMapping({}, function(err, mapping) { 
    if (err) { 
     console.log('error creating mapping (you can safely ignore this)'); 
     console.log(err); 
    } else { 
     console.log('mapping created!'); 
     console.log(mapping); 
    } 
}); 

illegal_argument_exception]マッパー[ラベル]は タイプ[文字列]から[完了]に変更できません

と私は

は[class_cast_exception] org.elasticsearch.index.mapper.core.StringFieldMapper $ StringFieldType が org.elasticsearch.index.mapper.coreにキャストすることはできません、次のエラーを得た検索を行うとき、 .CompletionFieldMapper $ CompletionFieldType

答えて

1

私は

curl -XDELETE localhost:9200/items 
を使用して問題を修正