繁体   English   中英

如何在弹性搜索中忽略空格

[英]How to ignore whitespaces in elastic search

在Elasticsearch中,我有一个名为“地址”的字段,在该字段中,数据被索引为

"322 Wall       Tax    Road"

在每个单词之间添加了多个空格。 因此,在搜索“ 322 Wall Tax Road”时不会返回数据。

有什么方法可以忽略其他空格而无需重新索引。 谢谢。

这是我当前的映射

"mappings": {
"esiid": {
"properties": {
"address": {
  "type": "string",
  "index": "not_analyzed"
},
"city": {
  "type": "string"
},

"zip": {
  "type": "string"
}
}
}

只用一个空格替换双空格怎么办?

$workedString = str_replace("  "," ",$yourString);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM