I'm trying to build an index for case-sensitive search. The index settings I'm using are at the bottom (including defining a custom "caseSensitive" analyzer).
If I perform a query like
GET /emails_text/_search
{
"fields": [
"text"
],
"query": {
"match": {
"text": {
"query": "begin",
"analyzer": "caseSensitive"
}
}
}
}
then it seems that the query itself is case sensitive (searching for capitalized terms gives no results), but the actual index seems to be all lowercased -- a lowercase query gives results for both lower and uppercase terms.
What am I doing wrong here? Am I querying wrong or should I be taking a different approach?
My index settings at creation time (ignore the stuff about shingles):
{
"settings": {
"analysis": {
"filter": {
"shingle_filter": {
"type": "shingle",
"max_shingle_size": 5
}
},
"analyzer": {
"shingles": {
"tokenizer": "standard",
"filter": [
"shingle_filter"
]
},
"caseSensitive": {
"tokenizer": "standard",
"filter": [
"standard",
"stop"
]
}
}
},
"mappings": {
"email": {
"properties": {
"sent": {
"type": "date",
"format": "epoch_millis"
},
"text": {
"type": "string",
"index_analyzer": "caseSensitive",
"search_analyzer": "caseSensitive",
"term_vector": "with_positions_offsets_payloads",
"store": true,
"fields": {
"shingle": {
"type": "string",
"index_analyzer": "shingles",
"search_analyzer": "caseSensitive"
}
}
}
}
}
}
}
}