使用elasticsearch进行索引映射时,将索引设置为not_analyzed会怎样?

时间:2012-11-04 00:14:58

标签: ruby-on-rails elasticsearch tire

:index => :not_analyzed如果将其映射到某个字段或者我是否将其添加到字段中,该怎么办?我在主要的github轮胎页面或elasticsearch.org网站上找不到定义。

代码示例:

class Article < ActiveRecord::Base
      include Tire::Model::Search
      include Tire::Model::Callbacks

      #...

      mapping do
        indexes :id,           :index    => :not_analyzed
        indexes :title,        :analyzer => 'snowball', :boost => 100
      end
end

1 个答案:

答案 0 :(得分:3)

未分析表示该字段按原样存储,并且未使用分析工具进行处理。 如果您分析它,您可以选择您的分析仪。默认情况下,应用标准分析器。它会破坏令牌中的内容,小写它们,删除标点符号,删除英语停用词(as,is,are,...)

我建议使用analyze API来理解分析器之间的区别:http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze.html

有关详细信息,请查看“分析”部分:http://www.elasticsearch.org/guide/reference/index-modules/analysis/