ElasticSearch boundary_chars不起作用

时间:2016-06-03 12:09:55

标签: elasticsearch

我有以下索引:

{
  "myindex" : {
    "mappings" : {
      "todo" : {
        "properties" : {
          "id" : {
            "type" : "long"
          },
          "title" : {
            "type" : "string",
            "store" : true,
            "term_vector" : "with_positions_offsets"
          }
        }
      }
    }
  }
}

使用以下文件:

{
  "_index" : "myindex",
  "_type" : "todo",
  "_id" : "2",
  "_version" : 1,
  "found" : true,
  "_source" : {
    "id" : 2,
    "title" : "That means that when used for instance in combination with a phrase query, it will highlight all the terms that the query is composed of, regardless of whether they are actually part of a query match, effectively ignoring their positions."
  }
}

现在我正在进行以下查询:

{
  "highlight": {
    "fields": {
      "title": {
        "fragment_size": 150,
        "boundary_max_size": 100,
        "boundary_chars": ",",
        "type": "fvh"
      }
    }
  },
  "query": {
    "match": {
      "title": {
        "type": "phrase",
        "query": "all the terms"
      }
    }
  }
}

这将返回一个突出显示的片段,如下所示:

for instance in combination with a phrase query, it will highlight <em>all the terms</em> that the query is composed of, regardless of whether they are actual

我希望突出显示的片段在按下定义的boundary_char'时'断开','。所以我希望突出显示的是:

it will highlight <em>all the terms</em> that the query is composed of

为什么实际突出显示的片段包含边界字符之前和之后的部分?这不是它应该如何工作吗?

0 个答案:

没有答案