escaping forward slashes in elasticsearch
Use this query as example:
{
"query": {
"query_string": {
"fields": [
"account_number.keyword"
],
"query": "AC\\/1234\\/A01",
"analyzer": "keyword"
}
}
}
You should get what you want without escaping anything simply by specifying a keyword
analyzer for the query string, like this:
{
"query" : {
"query_string" : {
"query" : "AC\\/1234\\/A01",
"analyzer": "keyword" <---- add this line
}
}
}
If you don't do this, the standard analyzer is used (and will tokenize your query string) whatever the type of your field is or whether it is not_analyzed
or not.