2 MatchFilter排序分页全文检索短语匹配关键词高亮
Posted cc299
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2 MatchFilter排序分页全文检索短语匹配关键词高亮相关的知识,希望对你有一定的参考价值。
查索引内所有文档记录
GET /beauties/my/_search
GET /beauties/my/_search
"query":
"match_all":
匹配、排序
GET /beauties/my/_search
"query":
"match":
"Name": "Ruru"
,
"sort": [
"Age": "desc"
]
筛选字段
GET /beauties/my/_search
"query":
"match_all":
,
"_source":["Name","Age"]
分页
GET /beauties/my/_search
"query":
"match_all":
,
"_source":["Name","Age"],
"from": 1,
"size": 2
bool filter、
GET /beauties/my/_search
"query":
"bool":
"must":
"match":
"Name": "Zhao"
,
"filter":
"range":
"Age":
"gt": 19,
"lt":24
GET /beauties/my/5
POST /beauties/my/5/_update
"doc":
"Desc":"Ruru Friend"
全文检索:会匹配Name的值,包含以下单词的,只要匹配一个单词就能搜出来,但score不一样
GET /beauties/my/_search
"query":
"match":
"Name": "Zhao Ruru Chang Aijing Wei"
短语搜索:必须匹配 Zhao Ruru才行。
对于Name=Zhao Ruru的记录,搜match_phrase=Zhao能搜出来,=Zha搜不出来
GET /beauties/my/_search
"query":
"match_phrase":
"Name": "Zhao Ruru"
高亮匹配的关键词。会在结果中,给关键词加上 em 标签
GET /beauties/my/_search
"query":
"match_phrase":
"Name": "Zhao"
,
"highlight":
"fields":
"Name":
以上是关于2 MatchFilter排序分页全文检索短语匹配关键词高亮的主要内容,如果未能解决你的问题,请参考以下文章
快速全文搜索在 MySQL 中按 id 排序的精确短语的一次出现
[Elasticsearch] 邻近匹配 - 短语匹配以及slop参数