中
im试图用以下映射索引特定文档
{
"session": { "_source": {
"enabled": false
},
"properties": {
"sessionId": {
"type": "string"
},
"start": {
"type": "date"
},
"text": {
"type": "string"
, "store": "yes"
}
}
}
}
搜索文本
{
"query": {
"bool": {
"must": [
{
"text": {
"session.text": "something"
}
}
]
}
}
}
我确实得到结果,但是session.text值不会存储在结果
禁用_source
时,您需要明确说明所需的字段,或指定*
以获取所有字段。
此处记录了这一点:http://www.elasticsearch.org/guide/en/elasticsearch/reference/referent/current/search-request-fields.html
在您的情况下,您要在搜索中指定"fields": ["text"]
。