弹性搜索分析器 - 小写和空白标记器 [英] elasticsearch analyzer - lowercase and whitespace tokenizer

查看:126
本文介绍了弹性搜索分析器 - 小写和空白标记器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我当前的映射,它通过空格来标记为空格我不明白如何小写它,并搜索(查询)相同的...

  {
映射 :{
my_type:{
properties:{
title:{type:string,analyzer:whitespace,tokenizer空格,search_analyzer:空白}
}
}
}
}

请帮助...

解决方案

我设法编写一个自定义分析器, ...

 设置:{
分析:{
analyzer
lowercasespaceanalyzer:{
type:custom,
tokenizer:whitespace,
filter:[
smallcase
]
}
}
}
},


mappings:{
my_type:{
properties:{
title:{type:string ,分析器:lowercasespaceanalyzer,tokenizer:空格,search_analyzer:空格,过滤器:[
小写
]}
}
}
}


How can I create a mapping that will tokenize the string on whitespace and also change it to lowercase for indexing?

This is my current mapping that tokenizes by whitespace by I cant understand how to lowercase it and also search (query) the same...

{
  "mappings": {
    "my_type" : {
      "properties" : {
        "title" : { "type" : "string", "analyzer" : "whitespace", "tokenizer": "whitespace", "search_analyzer":"whitespace" }
      }
    }
  }
}

Please help...

解决方案

i managed to write a custom analyzer and this works...

"settings":{
  "analysis": {
    "analyzer": {
      "lowercasespaceanalyzer": {
        "type": "custom",
        "tokenizer": "whitespace",
        "filter": [
          "lowercase"
        ]
      }
    }
  }
},


"mappings": {
 "my_type" : {
  "properties" : {
    "title" : { "type" : "string", "analyzer" : "lowercasespaceanalyzer", "tokenizer": "whitespace", "search_analyzer":"whitespace", "filter": [
      "lowercase"
    ] }
  }
 }
}

这篇关于弹性搜索分析器 - 小写和空白标记器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆