【问题标题】:How to ignore whitespaces in elastic search如何在弹性搜索中忽略空格
【发布时间】:2018-04-11 08:03:39
【问题描述】:

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

"322 Wall       Tax    Road"

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

有没有办法在不重新索引的情况下忽略额外的空格。 谢谢。

这是我当前的映射

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

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

【问题讨论】:

标签: php elasticsearch elasticsearch-plugin elasticsearch-5


【解决方案1】:

用一个空格简单地替换双空格怎么样?

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-08
    • 1970-01-01
    • 2021-07-10
    • 1970-01-01
    • 1970-01-01
    • 2014-06-06
    • 2021-06-12
    • 1970-01-01
    相关资源
    最近更新 更多