【发布时间】:2014-10-02 10:22:18
【问题描述】:
我试图弄清楚如何使用 elasticsearch 查询对象中的特定字段。 我的索引文档如下所示:
{
name : 'thename'
meta : {
title : {value: 'foo is the title'}
headline: {value : 'bar is the headline'}
}
}
例如,我将如何创建针对 meta.title.value 的查询?
这真的支持吗?
我可以在不指定键的情况下查询这些值:
{
query: 'foo'
}
我得到了正确的结果,但如果我只想在元对象中搜索那个特定的键,我不知道该怎么做。
更具体地说,我使用mongoose 和mongoosastic,如果这有什么不同的话。
这里是我在 elasticsearch 上的文档映射:
"mappings": {
"asset": {
"properties": {
"kind": {
"type": "string"
},
"meta": {
"properties": {
"description": {
"properties": {
"value": {
"type": "string"
}
}
},
"headline": {
"properties": {
"value": {
"type": "string"
}
}
},
"visible": {
"type": "boolean"
}
}
}
}
}
}
【问题讨论】:
标签: elasticsearch mongoosastic