Elasticsearch-4种内置分析器
2016-03-03 23:38
423 查看
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 analyzerThe 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, 5Simple analyzerThe 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, transWhitespace analyzerThe 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 analyzersLanguage-specific analyzers are available for many languages. They are able to take the peculiarities of the specified language into account. For instance, the
englishanalyzer comes with a set of Englishstopwords (common words like
andor
thethat 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
englishanalyzer would produce the following:
set, shape, semi, transpar, call, set_tran, 5Note how
transparent,
calling, and
set_transhave 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-textstringfield and analyzes it with the
standardanalyzer.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
相关文章推荐
- ubuntu下软件包安装故障解决方案(深入剖析专治疑难)
- C++中关于类(封装、继承、多态)区别于结构体的理解
- linux生产服务器有关网络状态的优化措施
- 程序员十大编程算法
- 51nod 1066 Bash游戏
- iOS开发-数据持久化-简书
- python学习(5)面向对象编程
- md5算法详解
- 第二次作业 邱鹏 2013551628
- 程序员十大编程算法
- XTU 1206 Dormitory's Elevator
- 深入理解Android内核设计思想——读书笔记
- 仿微信公众平台登录页面
- KMP算法
- .NET中的堆(Heap)和栈(Stack)的本质
- OPENCV3.1+VS 坑我笔记!
- angular.js 动态插入删除dom节点
- hibernate,spring,struts面试题
- MarkDownPad-Pro体验
- matlab神经网络工具箱的使用