弹性搜索不会返回索引字段

时间:2016-04-07 14:50:47

标签: elasticsearch lucene

我正在使用弹性搜索进行非常基本的搜索:

我的索引映射类似于:

{
  "channels": {
    "mappings": {
      "channel": {
        "properties": {
          "channel": {
            "properties": {
              "description": {
                "type": "string"
              },
              "id": {
                "type": "long"
              },
              "name": {
                "type": "string"
              },
.................
....................

我的查询如下:

{
"query": 
 { 
 "match":
  { 

   "description": "hubble"

   } 

  } 

}

现在,即使文档的说明字段中存在“hubble”,此搜索结果也会达到0次点击。

但是,当我在_all字段上运行此查询时,它会按预期返回文档。

如映射中所示,描述字段正在被分析为全文(这是默认选项)。因此,当仅指定此字段时,搜索应返回命中。

我错过了什么?

1 个答案:

答案 0 :(得分:0)

使用' channel.description'帮助。应该想到这个!

感谢Val。

相关问题