lucene - Elasticsearch使整个索引或类型为not_analyzed

标签 lucene elasticsearch

创建 Elasticsearch 索引时,我不知道将在新文档中插入哪些字段。因此,我无法在创建索引时指定哪些字段为"index": "not_analyzed"。幸运的是,我希望所有字段都是not_analyzed,所以有没有办法拥有整个索引或类型,即所有创建的字段not_analyzed

最佳答案

根据documentation在创建索引时将分析器defaultdefault_index定义为keyword类型。


{
   "settings": {
      "analysis": {
         "analyzer": {
            "default": {
               "type": "keyword"
            }
         }
      }
   }
}

您现在也可以按type来定义分析器的范围,但是在以后的发行版8874中它似乎已弃用。

但是,当前您可以为映射中的类型设置默认分析器,如下所示:
put test/test_type/_mapping
{
   "test_type" : { 
         "analyzer": "keyword"
   }
}

关于lucene - Elasticsearch使整个索引或类型为not_analyzed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31866303/

相关文章:

java - 基于响应中分数的 Elasticsearch 查询

google-maps - ElasticSearch 地理数据库 : geo_distance filter returns geo pins in ellipse not in circle

java - ElasticSearch 聚合 - 获取时间序列中最大直方图值的确切时间

lucene - 如何处理多个IndexWriter和多个跨进程IndexWriter

lucene - 在构建索引时提升 Lucene 术语

java - 保证 Solr 提交已经发生

java - 在 Lucene 中通过 ComplexPhraseQueryParser 使用多个字段

Elasticsearch Marvel 将 .marvel-2015-* 索引设置为最大值

ruby-on-rails - Elasticsearch为法语或英语字段配置词干

c# - Lucene.net:使用 MultiFieldQueryParser 时没有搜索结果