So I have a field that stores a value in the format: number/year, something like 23/2014, 24/2014, 12/2015, etc...
so if this field is mapped as a not_analyzed one, I can make exact value searches with term filter, if I search for a value in that exact structure(something like 1/2014, 15/2014,...) it works, like the sql equals(=).
{
"query": {
"filtered": {
"filter": {
"term": {
"processNumber": "11/2014"
}
}
}
}
}
So, searching with something different like 11/, or /2014 wouldn't return hits. This is fine.
But if I define the field as not_analyzed, I can't make sql LIKE type searches with the match_phrase query.
{
"query": {
"match_phrase": {
"processNumber": "11/201"
}
}
}
In this case searching for 11,11/,/2014 or 2014 should return hits, but they don't.
The thing is, this query works if the field is not mapped as a not_analyzed one. So it seems I have to either use one or the other, the problem is that the field should support both options for different queries, am I missing something here?