0

我正在尝试查询具有多个索引和类型的多个表,但在 mongoosastic 中没有关于多索引、多类型查询的文档。

请参阅此文档尝试做同样的事情,但使用 mongoosastic 查询。

4

1 回答 1

0

我遇到过同样的问题。请执行以下操作以使其正常工作。

确保您删除了索引:

通过邮递员删除请求,例如:http: //127.0.0.1 :9200 / {your_name}

然后在节点 JS 中创建一个像这样的映射:

var schema = new Schema({
    product_name: String,
    description: {
        type: String,
        es_type: 'multi_field',
        es_fields: {
            multi_field: { type: 'string', index: 'analyzed' },
            untouched: { type: 'string', index: 'not_analyzed' }
        }
    }
});

最后你可以这样查询:

{
"query" : {
    "constant_score" : {
        "filter" : {
            "term" : {
                "description.multi_field" : "nog een testje"
            }
        }
    }
}}// to use other field, change the . after description
{
"query" : {
    "constant_score" : {
        "filter" : {
            "term" : {
                "description.untouched" : "nog een testje"
            }
        }
    }
}

}

于 2016-06-09T11:55:20.677 回答