Skip to content

高亮显示关键词

GET /user/_search
{
  "query": {
    "match": {
      "name": "李四"
    }
  },
  "highlight": {
    "fields": {
      "address": {
        "pre_tags": "<span style='color:red'>", # 开始标签
        "post_tags": "<span/>" # 结束标签
      }
    }
  }
}
GET /user/_search
{
  "query": {
    "match": {
      "name": "李四"
    }
  },
  "highlight": {
    "fields": {
      "address": {
        "pre_tags": "<span style='color:red'>", # 开始标签
        "post_tags": "<span/>" # 结束标签
      }
    }
  }
}

备案号:冀ICP备20015584号-2