Elasticsearch 搜索 分词器 过滤器
所属分类 elasticsearch
浏览量 1075
查找分类为Java 的文章
/articles/_search?q=category:java
/articles/_search?q=java&df=category
/articles/_search?q=category:java架构师
/articles/_search?q=content:java架构师
/articles/_search?q=content:java架构师&default_operator=and
/articles/_search?q=content:java架构师&default_operator=or
/articles/_search?q=content:java架构师&default_operator=or&analyzer=standard
/articles/_search?q=content:java架构师&default_operator=or&analyzer=simple
/articles/_search?q=content:java%20架构师&default_operator=or&analyzer=simple
/articles/_search?q=content:java架构师&default_operator=or&analyzer=ik_smart
/articles/_search?q=content:java架构师&default_operator=or&analyzer=ik_max_word
/articles/_search?q=java程序员&default_operator=and
/articles/_search?q=java程序员&df=title&default_operator=and
POST /articles/_search
{
"query":{
"term":{
"category":"java"
}
}
}
{
"query":{
"term":{
"category":"java架构师"
}
}
}
全文检索
POST /articles/_search
{
"query":{
"match":{
"category":"Java架构师"
}
}
}
POST /articles/_search
{
"query":{
"match":{
"title":"Java架构师"
}
}
}
POST /articles/_search
{
"query":{
"match":{
"content":"Java架构师"
}
}
}
POST /articles/_search
{
"query":{
"match":{"Java架构师"}
}
}
{
"profile": "true",
"query":{
"term":{
"content":"java架构师"
}
}
}
{
"profile": "true",
"query":{
"match":{
"content":"java架构师"
}
}
}
{
"profile": "true",
"query":{
"match_phrase":{
"content":"java架构师"
}
}
}
{
"query": {
"multi_match": {
"query": "java",
"fields": ["title", "content","category"]
}
}
}
{
"query": {"terms": {"title": ["java","linux"]}}
}
Analysis
文本分析 分词 把文本转换成一系列单词(term/token)
Analysis通过Analyzer来实现
analyzer 三大组件
character filters , tokenizers , token filters
1) character filter 字符过滤器
文本预处理,譬如过滤html标签
2) tokenizers 分词器
英文分词可以根据空格将单词分开,中文分词比较复杂
3) Token filters Token过滤器
将切分的单词进行加工 ,大小写转换 ,去掉词(例如停用词等),或者增加词(例如同义词)
三者顺序
Character Filters--->Tokenizer--->Token Filter
POST _analyze
{
"analyzer": "standard",
"text": "Java架构师"
}
{
"analyzer": "standard",
"text": "Java 架构师"
}
{
"analyzer": "simple",
"text": "Java架构师"
}
{
"analyzer": "simple",
"text": "Java 架构师"
}
{
"analyzer": "ik_smart",
"text": "Java架构师"
}
{
"analyzer": "ik_smart",
"text": "Java 架构师"
}
{
"analyzer": "ik_max_word",
"text": "Java架构师"
}
{
"analyzer": "ik_max_word",
"text": "Java 架构师"
}
{
"tokenizer": "lowercase",
"text": "JAVA 架构师"
}
{
"tokenizer": "standard",
"filter": ["lowercase"],
"text": "JAVA 架构师"
}
html字符过滤
{
"tokenizer": "ik_max_word",
"filter": ["lowercase"],
"char_filter": [ "html_strip" ],
"text": "我是
JAVA 架构师"
}
Elasticsearch分词器
elasticsearch5.0基于url的搜索接口
上一篇
下一篇
常见的安全漏洞
分布式事务六种解决方案
elasticsearch禁用自动创建索引和类型
elasticsearch使用7大原则
elasticsearch profile 使用简介
Elasticsearch聚合分析简介