- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 ElasticSearch 环境中工作,我在本地机器上安装了 elasticsearch 5.4.3 版本。我正在尝试通过定义一些设置以及映射来创建索引。以下是我的设置和映射,
{
"settings":{
"index":{
"analysis":{
"analyzer":{
"index_analyzer":{
"filter":[
"standard",
"lowercase",
"asciifolding"
],
"tokenizer":"standard"
},
"autocomplete":{
"type":"custom",
"tokenizer":"standard",
"filter":[
"lowercase",
"autocomplete_filter"
]
},
"search_analyzer":{
"filter":[
"standard",
"lowercase",
"asciifolding"
],
"tokenizer":"standard"
},
"sortable":{
"filter":"lowercaseFilter",
"tokenizer":"keyword",
"type":"custom"
}
},
"filter":{
"lowercaseFilter":{
"type":"lowercase"
},
"autocomplete_filter":{
"type":"edge_ngram",
"min_gram":1,
"max_gram":20
}
},
"tokenizer":{
"keyword":{
"type":"keyword"
}
}
}
}
}
}
这是我的映射,
{
"geo_data":{
"_all":{
"enabled":true,
"index_analyzer":"index_analyzer",
"search_analyzer":"search_analyzer"
},
"properties":{
"subscriber_level":{
"analyzer":"index_analyzer,search_analyzer,autocomplete_analyzer",
"type":"text"
},
"att_id":{
"analyzer":"index_analyzer,search_analyzer,autocomplete_analyzer",
"type":"text"
},
"id":{
"include_in_all":false,
"type":"text"
},
"name":{
"analyzer":"index_analyzer,search_analyzer,autocomplete_analyzer",
"type":"text"
},
"state_name":{
"analyzer":"index_analyzer,search_analyzer,autocomplete_analyzer",
"type":"text"
}
}
}
}
我想要实现的是,我想将所有自定义分析器应用于单个字段。但是上面的分析器字段映射给出了以下异常,
{
"error":{
"root_cause":[
{
"type":"mapper_parsing_exception",
"reason":"analyzer [index_analyzer,search_analyzer,autocomplete_analyzer] not found for field [subscriber_level]"
}
],
"type":"mapper_parsing_exception",
"reason":"analyzer [index_analyzer,search_analyzer,autocomplete_analyzer] not found for field [subscriber_level]"
},
"status":400
}
请任何人都可以帮助我解决这个问题,努力解决它。
最佳答案
您希望使用多个分析器对同一字段进行分词。您可以使用 multi-fields并对多字段内的每种类型应用不同的分析器。
也在关注这个github issue , _all 字段的配置在 5.4 中发生了变化。如果你的索引已经存在,
PUT some_index/_mappings/type_name
{
"_all": {
"enabled": true,
"type": "text",
"analyzer": "index_analyzer"
},
"properties": {
"subscriber_level": {
"type": "keyword",
"fields": {
"index_analyzed": {
"type": "text",
"analyzer": "index_analyzer"
},
"search_analyzed": {
"type": "text",
"analyzer": "search_analyzer"
},
"autocomplete_analyzed": {
"type": "text",
"analyzer": "autocomplete"
}
}
},
"att_id": {
"type": "keyword",
"fields": {
"index_analyzed": {
"type": "text",
"analyzer": "index_analyzer"
},
"search_analyzed": {
"type": "text",
"analyzer": "search_analyzer"
},
"autocomplete_analyzed": {
"type": "text",
"analyzer": "autocomplete"
}
}
},
"id": {
"include_in_all": false,
"type": "text"
},
"name": {
"type": "keyword",
"fields": {
"index_analyzed": {
"type": "text",
"analyzer": "index_analyzer"
},
"search_analyzed": {
"type": "text",
"analyzer": "search_analyzer"
},
"autocomplete_analyzed": {
"type": "text",
"analyzer": "autocomplete"
}
}
},
"state_name": {
"type": "keyword",
"fields": {
"index_analyzed": {
"type": "text",
"analyzer": "index_analyzer"
},
"search_analyzed": {
"type": "text",
"analyzer": "search_analyzer"
},
"autocomplete_analyzed": {
"type": "text",
"analyzer": "autocomplete"
}
}
}
},
"settings": {
"index": {
"analysis": {
"analyzer": {
"index_analyzer": {
"filter": [
"standard",
"lowercase",
"asciifolding"
],
"tokenizer": "standard"
},
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
},
"search_analyzer": {
"filter": [
"standard",
"lowercase",
"asciifolding"
],
"tokenizer": "standard"
},
"sortable": {
"filter": "lowercaseFilter",
"tokenizer": "keyword",
"type": "custom"
}
},
"filter": {
"lowercaseFilter": {
"type": "lowercase"
},
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"tokenizer": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
现在您可以使用任何已分析的字段进行查询,如下所示
POST some_index/_search
{
"query": {
"term": {
"state_name.index_analyzed": {
"value": "VALUE"
}
}
}
}
谢谢
关于curl - 将多个自定义分析器设置为 Elasticsearch 中的单个字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44850239/
我最近开始使用 Scala 编程。我正在寻找免费的 Scala 分析器。从该语言的官方网站阅读后,我找到了 YourKit ,但该程序不是免费的。 谷歌搜索“scala profiler”没有给我任何
是否有一个程序可以让我获得有关脚本的详细信息:具体来说,我希望能够跟踪其内存占用情况并查看内存中有多少对象。 Firebug 有一个分析器,似乎可以提供计时信息,但我对内存管理更感兴趣。 最佳答案 G
Erlang 有没有好的代码分析器/分析器?我需要一些可以为我的代码构建调用图的东西。 最佳答案 对于静态代码分析,您有 Xref和 Dialyzer ,对于分析,您可以使用 cprof、fprof
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
什么是“self”和“total”列? “总计”列加起来不等于 100%(高得多),看起来像 self 一样。我怀疑 self 是非累积的,而 total 是。因此,如果 methodA 调用 met
在 Perl 中,有一个非常好的分析器,称为 NYTProf。 在其报告中包含 flame graph ,这样就很容易找到程序的瓶颈 是否有一个等效的 java profiler 可以生成相同的报告?
我想知道是否有办法在c++程序中查看特定部分的调用路径。我在开源代码中工作,其中包含许多库。我尝试按照最终在模板中的路径中的代码进行操作。那么,是否有这样的库或分析器来显示代码特定部分的调用路径? 谢
我正在寻找支持每个请求分析统计的分析器,最好是沿着程序流(而不是通常的线程调用堆栈)。所以基本上是每个请求的探查器调用堆栈 + 顺序调用 View ,如下所示: doGet
如何让 symfony profiler 在 phpstorm 中工作?它应该在状态栏中,但是当我打开那个窗口时,它总是说:“这里什么都没有”。缓存目录在配置中正确定义,symfony 插件本身工作正
人们在 Unix 中用来解析/分析日志文件的流行工具是什么?进行计数,查找唯一性,选择/复制具有特定模式的特定行。请提供一些工具或一些关键字。因为我相信以前肯定有类似的问题,但我对关键字一无所知。谢谢
我设置了一个过滤器来计算执行的查询数量,并在超过某个限制时将一些内容写入我的数据库。 它在我的开发环境中运行良好,但是当我在生产环境中测试它时,我的数据库不再返回分析器。我认为这是一个为开发环境启用数
你找到这样的工具并成功使用了吗? 最佳答案 我也在寻找 AS 的分析器,但我想要一个与 FlashDevelop 和 Flex SDK 配合使用的免费软件/开源解决方案。我没有找到。所以我写了一个简单
我需要扩展 SonarQube,以便我可以向其中添加新的分析器。我尝试使用 xpath 为 java 文件添加新规则。我想知道如何在 SonarQube 中添加新语言的代码分析器,例如对于 .meta
我可以在C#(嵌套)中使用elasticsearch 2.3.0版本 我想将分析与索引一起使用, 但是索引设置不会改变,我也不知道为什么。 这是我的代码: private void b
我有一个正在wireshark中查看的自定义协议(protocol)。我认为如果wireshark可以帮我剖析它,这样我就不必解码十六进制了,这会很有用。尽管我在程序日志中执行此操作,但wiresha
我正在考虑使用 Elasticsearch 来提供我们网站的搜索功能。 我一直在试验它,但无法启用 Porterstem 分析器(以便搜索战斗匹配战斗和战斗)。 这是我输入的摘要。 curl
我正在尝试运行一个基于java的java分析器来找出我的专用机器上的java应用程序的资源消耗情况。我尝试使用的分析器称为 Warmroast。 运行时出现以下错误。 java -jar warmro
我没有从我的分析器获得预期结果,并且想测试标记化过程。 此问题的答案:How to use a Lucene Analyzer to tokenize a String? List result =
我在 Lucene 中有特殊的分析需求,但我想继续使用 StandardAnalyzer 机制的部分内容。 特别是,我想要字符串 “-苹果--胡萝卜-番茄?” 被标记为: “-苹果-”2.“-胡萝卜-
有什么好的 JSF 分析器推荐吗? 我正在使用 Tomcat 6 JSF2、 hibernate 和 Spring 最佳答案 如果您使用的是 Eclipse 或 Netbeans 之类的 IDE,那么
我是一名优秀的程序员,十分优秀!