簡體   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