栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

mapper_parsing_exception为自定义分析器,同时在Elasticsearch中创建索引?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

mapper_parsing_exception为自定义分析器,同时在Elasticsearch中创建索引?

由于错误消息描述了自定义分析仪,例如

my_analyzer
不是
index
映射中选项的有效值。根据文档,它只能采用的值是

没有

不要将此字段值添加到索引中。使用此设置,该字段将不可查询。

not_analyzed

将字段值不变地添加到索引中,作为一项。这是所有支持此选项的字段(字符串字段除外)的默认设置。not_analyzed字段通常与术语级查询一起用于结构化搜索。

分析

此选项仅适用于字符串字段,这是默认设置。首先分析字符串字段值,以将字符串转换为术语(例如,单个单词的列表),然后对其进行索引。在搜索时,查询字符串(通常)通过同一分析器传递,以生成与索引中的格式相同的术语。正是这个过程使全文搜索成为可能。

如果要为字段设置自定义分析仪,请使用分析仪选项

例:

{    "settings": {        "analysis": { "char_filter": {     "&_to_and": {         "type": "mapping",         "mappings": ["& => and"]     } }, "filter": {     "my_stopwords": {         "type":       "stop",         "stopwords": ["the", "a"]     } }, "analyzer": {     "my_analyzer": {         "type":         "custom",         "char_filter":  ["html_strip", "&_to_and"],         "tokenizer":    "standard",         "filter":       ["lowercase", "my_stopwords"]     },     "folding": {         "token_filters": ["lowercase", "asciifolding"],         "tokenizer": "standard",         "type": "custom"     } }        }    },    "mappings": {        "tweet": { "dynamic": "strict", "properties": {     "author": {         "type": "string",         "analyzer": "my_analyzer",         "store": true     },     "text": {         "type": "string",         "analyzer": "folding",         "store": true     },     "timestamp": {         "type": "date",         "format": "yyyy-MM-dd'T'HH:mm:ssZ",         "store": true     } }        }    }}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/399575.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号