Reputation: 33
I have not specified any analyzer and I have a field which has a hex. String where all the letters present are being converted to lower case.
How do I stop it (what's analyzer/token filter should be used)?
Upvotes: 0
Views: 894
Reputation: 3573
If an analyzer is not specified then the default standard analyzer and the keyword analyzer are applied, they do the following:
Standard Analyzer
The standard analyzer divides text into terms on word boundaries, as defined by the Unicode Text Segmentation algorithm. It removes most punctuation, lowercases terms, and supports removing stop words.
Keyword Analyzer
The keyword analyzer is a “noop” analyzer that accepts whatever text it is given and outputs the exact same text as a single term.
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-analyzers.html
To access the no-op (no operation) keyword analyzer where case is preserved add .keyword
to the end of the field name like so:
{
"query": {
"term" : {
"hex_value.keyword" : "#00FF00"
}
}
}
This will perform the case sensitive search sought after.
Upvotes: 1