I want to index the month
field of a bibtex entry into elasticsearch and make it searchable via the range
query. This requires the underlying field type to be some kind of numeric datatype. In my case short
would be sufficient.
The bibtex month
field in its canonical form requires a three character abbreviation, so I tried to use the char_filter
like so:
...
"char_filter": {
"month_char_filter": {
"type": "mapping",
"mappings": [
"jan => 1",
"feb => 2",
"mar => 3",
...
"nov => 11",
"dec => 12"
]
}
...
"normalizer": {
"month_normalizer": {
"type": "custom",
"char_filter": [ "month_char_filter" ],
},
And put up mappings like this:
...
"month": {
"type": "short",
"normalizer": "month_normalizer"
},
...
But it doesn't seem to work since the type
field doesn't support normalizers like this, as well as it doesn't support analyzers.
So what would be the approach to implement such a mapping as shown in the char_filter
part so there are range query possibilites?