【问题标题】:suggester completion issue with mongoosastic 4.x and elasticsearch 2.2mongoosastic 4.x 和 elasticsearch 2.2 的建议完成问题
【发布时间】:2016-03-20 23:20:08
【问题描述】:

我正在尝试使用 mongoosastic 进行自动完成 我有以下代码:

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] 映射器 [label] 不能从 键入 [string] 到 [completion]]

当我进行搜索时,我收到以下错误

[class_cast_exception] org.elasticsearch.index.mapper.core.StringFieldMapper$StringFieldType 不能转换为 org.elasticsearch.index.mapper.core.CompletionFieldMapper$CompletionFieldType

【问题讨论】:

    标签: node.js elasticsearch mongoose mongoosastic


    【解决方案1】:

    我使用

    解决了这个问题
    curl -XDELETE localhost:9200/items
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-22
      • 1970-01-01
      • 1970-01-01
      • 2015-02-19
      • 2020-07-14
      • 1970-01-01
      • 2015-05-07
      • 1970-01-01
      相关资源
      最近更新 更多