白话Elasticsearch06- 手动控制全文检索结果的精准度

版权声明:【show me the code ,change the world】 https://blog.csdn.net/yangshangwei/article/details/90146798

文章目录

概述

继续跟中华石杉老师学习ES,第五篇

课程地址: https://www.roncoo.com/view/55

如果我们要想对全文检索的方式实现更细粒度的控制该怎么办呢? 这里我们就来探讨下手动控制全文检索结果的精准度的几种方式


数据

为了说明该部分,我们给帖子数据增加标题title字段

POST /forum/article/_bulk
{"update":{"_id":"1"}}
{"doc":{"title":"this is java and elasticsearch blog"}}
{"update":{"_id":"2"}}
{"doc":{"title":"this is java blog"}}
{"update":{"_id":"3"}}
{"doc":{"title":"this is elasticsearch blog"}}
{"update":{"_id":"4"}}
{"doc":{"title":"this is java, elasticsearch, hadoop blog"}}
{"update":{"_id":"5"}}
{"doc":{"title":"this is spark blog"}}

总结一下

  • 1、全文检索的时候,进行多个值的检索,有两种做法,match query;should
  • 2、控制搜索结果精准度:and operator、minimum_should_match

猜你喜欢

转载自blog.csdn.net/yangshangwei/article/details/90146798