简体   繁体   中英

How to ignore whitespaces in elastic search

In Elasticsearch, I have a field called "address", in that field data is indexed as

"322 Wall       Tax    Road"

In between each words multiple spaces have been added. So while searching for "322 Wall Tax Road" does not returning data.

is there any way to ignore additional whitespaces without reindexing. Thank you.

This is my current mapping

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

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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