I currently have this mapping, where categories is an array of strings.
"events": {
"mappings": {
"event": {
"properties": {
......
"categories": {
"type": "string",
"index": "not_analyzed"
}
.......
}
It works great for searching and I have had no problem until I added this category "Sorting & Penning".
For some reason when adding a & to the strings in the categoires I will get no results when searching.
{
"_index" : "events",
"_type" : "event",
"_id" : "48",
....
"categories" : [ "Playdays", "Sorting & Penning" ],
....
}
But if I change the category name to Sort and Penning, then when I a search I go get all the expected results. The problem is when I add the &. I thought that my making it "index": "not_analyzed" I would be search as exact values, which is what I need.
This is an example of the query used
'query': {
'bool':
{'filter': [
{'term': {'categories': 'Sorting & Penning'}}],
'must': [
{
'match_all': {}
}
]
}
}