elasticsearch - Elasticsearch 语言分析器 - 文本分析后返回检索到的字段
问题描述
我正在研究 Elasticsearch 中的全文搜索引擎,并在索引时间使用多语言数据。我使用弹性搜索进行文本分析,我希望能够在预处理后返回令牌(检索到的索引)。我知道分析 API,但是对 +200.000 个文档执行此操作非常耗时。我找到了“术语聚合”,但我不确定它是如何工作的。有任何想法吗?
我用在映射语言分析器中。使用语言分析器或每个文档都通过每个语言分析器时是否有任何开箱即用的语言检测?如果是这样,使用语言检测并为每种语言创建多字段是否有意义?在设置或映射中使用语言分析器有什么区别?
PUT /index_sample
{
"settings": {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"type" : "custom",
"tokenizer" : "standard",
"filter" : [
"my_asciifolding",
"my_apostrophe",
"cjk_bigram"]
}
},
"filter" : {
"my_asciifolding" : {
"type" : "asciifolding",
"preserve_original" : true
},
"my_apostrophe" :{
"type" : "apostrophe"
}
}
}
},
"mappings" : {
"properties": {
"category_number" : {
"type" : "integer",
"fields" : {
"raw" : {
"type" : "keyword"
}
}
},
"product": {
"type" : "text",
"index" : "true",
"store" : "true",
"analyzer" : "my_analyzer",
"fields" : {
"german_field": {
"type" : "text",
"analyzer": "german"
},
"english_field" : {
"type" : "text",
"analyzer" : "english"
},
"chinese_field" : {
"type" : "text",
"analyzer" : "smartcn"
},
"spanish_field": {
"type" : "text",
"analyzer" : "spanish"
},
"czech_analyer" : {
"type" : "text",
"analyzer" : "czech"
},
"french_field": {
"type" : "text",
"analyzer" : "french"
},
"italian_field" : {
"type" : "text",
"analyzer" : "italian"
},
"dutch_field": {
"type" : "text",
"analyzer" : "dutch"
},
"portuguese_field": {
"type" : "text",
"analyzer" : "portuguese"
}
}
}
}
}
}
解决方案
如果您想查看索引字段的外观,您可以使用 _analysis API(我相信您不想这样做)
或者你可以看看 _termvectors
GET /<index_name>/_termvectors/<doc_id>?fields=<filed_name>
推荐阅读
- react-native - GoogleAPIs 与 React Native / Expo 的集成
- laravel - 多输入搜索表单
- html - 如何在 ::-webkit-scrollbar-button 中添加伪元素
- python - Discord.py:如何从用户输入消息中获取命令的确切字词?
- video - 怎么给视频加水印。即 png 和 text
- file - Visual Studio Code 打开多个实例
- flutter - 如何在 Flutter 中集成 PayPal 订阅?
- javascript - 三角形最小路径总和自上而下而不是自下而上
- python - 400 使用 TLS 包装器重放捕获的 HTTP/2 请求数据包时来自某些网站的错误请求
- amazon-web-services - 在 IAM 中列出特定任务所需的所有权限的最简单方法是什么?