我正在尝试查询具有多个索引和类型的多个表,但在mongoosastic中没有关于多索引、多类型查询的文档。
引用这个doc,尝试做同样的事情,但是使用mongoosastic查询。
发布于 2016-06-09 19:55:21
我也有同样的问题。请执行以下操作以使其正常工作。
确保删除了索引:
邮递员DELETE请求示例: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"
}
}
}
}}
https://stackoverflow.com/questions/37189532
复制相似问题