Hey there,
I have an existing index without any custom setting or mapping for any field, so everything is by default.
Into the docs I have a field named category which contains words like Women's or Womens.
POST my_index/_doc/
{
"message": "This is the first document",
"category": "Womens"
}
POST my_index/_doc/
{
"message": "This is the second document",
"category": "Women's"
}
I would like to get both type of docs with a _search operation.
So, I was trying to change index _settings with a custom char_filter to remove the single quote character:
PUT my_index/_settings
{
"analysis": {
"analyzer": {
"my_analyzer": {
"type": "custom",
"tokenizer": "standard",
"char_filter": [
"my_char_filter"
]
}
},
"char_filter": {
"my_char_filter": {
"type": "mapping",
"mappings": [
"' => "
]
}
}
}
}
When I tried a _search I got only one type of document:
GET my_index/_search
{
"query": {
"match": {
"text": {
"category": "Womens"
}
}
}
}
In another scenario, if I start from scratch creating a custom index as follow:
PUT my_index
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"type": "custom",
"tokenizer": "standard",
"char_filter": [
"my_char_filter"
]
}
},
"char_filter": {
"my_char_filter": {
"type": "mapping",
"mappings": [
"' => "
]
}
}
}
},
"mappings": {
"properties": {
"text": {
"type": "text",
"analyzer": "my_analyzer"
}
}
}
}
my search query will work.
What is wrong?