On Elasticsearch how can you query a string attribute ignoring white spaces ?
The scenario is having phone numbers indexed as strings, with different formatings. Querying a phone without spaces, can I get all strings that have that phone (with or without spaces). For example:
{
"query": {
"bool": {
"must": [
{
"match_all": {}
}
],
"must_not": [],
"should": []
}
},
"filter": {
"nested": {
"path": "Contacts",
"query": {
"query_string": {
"default_field": "Contacts.ContactValue",
"query": "261981255"
}
}
}
}
}
This query would return contacts like: "261981255", "261 981 255", "26 19 81 25 5", etc.
match_allcan just be"query" : { "match_all" : { } }.