Elasticsearch-4种内置分析器
来源:互联网 发布:linux vi创建c文件 编辑:程序博客网 时间:2024/06/07 01:32
新手需要特别注意ES中内置的分析器,否则查询结果很可能不是预期的,分析器它直接影响到Search与Index操作。
Built-in Analyzers
However, Elasticsearch also ships with prepackaged analyzers that you can use directly. We list the most important ones next and, to demonstrate the difference in behavior, we show what terms each would produce from this string:
"Set the shape to semi-transparent by calling set_trans(5)"
- Standard analyzer
The standard analyzer is the default analyzer that Elasticsearch uses. It is the best general choice for analyzing text that may be in any language. It splits the text on word boundaries, as defined by theUnicode Consortium, and removes most punctuation. Finally, it lowercases all terms. It would produce
set, the, shape, to, semi, transparent, by, calling, set_trans, 5
- Simple analyzer
The simple analyzer splits the text on anything that isn’t a letter, and lowercases the terms. It would produce
set, the, shape, to, semi, transparent, by, calling, set, trans
- Whitespace analyzer
The whitespace analyzer splits the text on whitespace. It doesn’t lowercase. It would produce
Set, the, shape, to, semi-transparent, by, calling, set_trans(5)
- Language analyzers
Language-specific analyzers are available for many languages. They are able to take the peculiarities of the specified language into account. For instance, the
english
analyzer comes with a set of Englishstopwords (common words likeand
orthe
that don’t have much impact on relevance), which it removes. This analyzer also is able to stem English words because it understands the rules of English grammar.The
english
analyzer would produce the following:set, shape, semi, transpar, call, set_tran, 5
Note how
transparent
,calling
, andset_trans
have been stemmed to their root form.4种分词器有各自的特征,根据实际查询需要指定适合的分词器,否则会有意想不到的查询结果。当需要为字段指定分词器时,可以使用mapping。
Specifying Analyzersedit
When Elasticsearch detects a new string field in your documents, it automatically configures it as a full-text
string
field and analyzes it with thestandard
analyzer.You don’t always want this. Perhaps you want to apply a different analyzer that suits the language your data is in. And sometimes you want a string field to be just a string field—to index the exact value that you pass in, without any analysis, such as a string user ID or an internal status field or tag.
To achieve this, we have to configure these fields manually by specifying the mapping.
官方文档:https://www.elastic.co/guide/en/elasticsearch/guide/current/analysis-intro.html- 当然,Elasticsearch也支持通过在映射文件中添加一个setting部分,自定义分析器或设置默认分析器。
- Elasticsearch-4种内置分析器
- Elasticsearch - 自定义分析器
- elasticsearch自定义分析器
- Elasticsearch - 自定义分析器
- [ElasticSearch]分析与分析器
- elasticsearch-自定义分析器
- Elasticsearch(分析和分析器)
- Elasticsearch(自定义分析器)
- Elasticsearch-自定义分析器
- lucene内置分析器
- elasticsearch系统分析器及自定义分析器
- ElasticSearch入门 第七篇:分析器
- ElasticSearch自定义分析器-集成结巴分词插件
- ElasticSearch自定义分析器-集成结巴分词插件
- ElasticSearch自定义分析器-集成结巴分词插件
- ElasticSearch自定义分析器-集成结巴分词插件
- Elasticsearch(九)【NEST高级客户端--分析器】
- ElasticsearchCRUD使用(十一)【Elasticsearch同义词分析器】
- 系统架构随记
- matlab神经网络工具箱的使用
- PAT (Advanced Level) Practise 1015 Reversible Primes (20)
- 设置单机防火墙的一个实例
- hive建表以及测试
- Elasticsearch-4种内置分析器
- iOS中的常用数据持久化
- MarkDownPad-Pro体验
- uva11039 设计建筑物
- 今天在php中把==写成了=
- hibernate,spring,struts面试题
- md5算法详解
- 深入理解Android内核设计思想——读书笔记
- 仿微信公众平台登录页面