4.1 match_phrase 核心参数:slop 参数-Token之间的位置距离容差值 代码语言:javascript 代码运行次数:0 复制 Cloud Studio代码运行 # 将上面的 match_phrase 查询新增一个 slop参数GET/tehero_index/_doc/_search{"query":{"match_phrase":{"content.ik_smart_analyzer":{"query":"关注我,系统学","slop":1}...
GET /exam/_search { "query": { "match_phrase": { "address": { "query": "book a", "slop": 2 } } } } match_phrase_prefix 匹配前缀,比如对于 address 值为 'read a book' 的数据,我们只知道的值是 'read a bo',想要根据这个搜索词搜索完整的数据,就可以用到 match_phrase_prefix。 他...
但是,这样的话我们对于这种业务场景可能会配置大量的词典,所以我们可以采用match_phrase进行短语模糊查询 match_phrase用于短语模糊查询,还是查询”一个多少个词语”,即它会将给定的短语”共多”当成一个完整的查询条件,然后查出含有该查询条件的内容 还可以通过slop参数告诉match_phrase查询词条能够相隔多远时仍然将文档视...
GET/my_index/my_type/_search{"query":{"match_phrase":{"title":{"query":"quick fox","slop":1}}} 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. slop参数告诉match_phrase查询词条能够相隔多远时仍然将文档视为匹配。相隔多远的意思是,你需要移动一个词条多少次来让查询和文档匹配? 我们以一个...
对于phrase_match 查询, query_array 为 ["我", "只是", "测试"] 不可以召回。因为元素顺序和 raw_array_n 的不一致(这里可以看出和 match 查询的区别); query_array 为 ["只是", "我", "测试"], slop=0 不可以召回。虽然顺序和 raw_array_n 的一致,但出现在 text_array_n 中的间隔元素个数不...
slop代表match phrase短语搜索的时候,单词最多移动多少次,可以实现数据匹配。在所有匹配结果中,多个单词距离越近,相关度评分越高,排序越靠前。这种使用slop参数的match phrase搜索,就称为近似匹配(proximity search) 举例: 数据为:hello world, java spark 搜索为:match phrase : hello spark。 slop为: 3 (代表...
1、match查询:会先对搜索词进行分词,比如“白雪公主和苹果”,会分成“白雪”“公主”“苹果”。含有相关内容的字段,都会被检索出来。 2、match_phrase查询:match_phrase与slop一起用,能保证分词间的邻近关系,slop参数告诉match_phrase查询词条能够相隔多远时仍然将文档视为匹配,默认是0。为0时 必须相邻才能被检索出...
直接用match_phrase短语搜索,会导致必须有term都在doc field中出现,而且距离在slop限定范围内,才能匹配上此时可以用bool组合match query和match_phrase query一起,来实现上述效果GET /forum/article/_search { "query": { "bool": { "must": { "match": { "title": { "query": "java spark" --> java...
GET/exam/_search{"query":{"match_phrase":{"address":{"query":"book a","slop":2}}} match_phrase_prefix 匹配前缀,比如对于 address 值为 'read a book' 的数据,我们只知道的值是 'read a bo',想要根据这个搜索词搜索完整的数据,就可以用到 match_phrase_prefix。 他...
能否matchPhrase把slop参数放出来可配置,让匹配更精确 #I6E2NA:建议调用matchPhrase把slop参数放出来可配置,让匹配更 之前有人提了这个issue,但是答复其实不是问题,原问题描述有些问题。 因为有些匹配 match无法满足,matchPhrase可以实现,但是顺序 要运行有偏差的。