Reputation: 253
Before the text in a field is indexed, I want to run code on it to transform it, basically what's going on here https://www.elastic.co/guide/en/elasticsearch/reference/master/gsub-processor.html (but that feature isn't out yet).
For example, I want to be able to transform all .
in a field into -
for the indexed version.
Any advice? Doing this in elasticsearch-rails.
Upvotes: 0
Views: 34
Reputation: 52368
Use a char_filter where you replace all .
into -
but this will change the characters of the indexed terms, not the _source
itself. Something like this:
"char_filter" : {
"my_mapping" : {
"type" : "mapping",
"mappings" : [
". => -"
]
}
}
or use Logstash with mutate and gsub filter to pre-process the data before being sent to Elasticsearch. Or you do it in your own indexer (whatever that is).
Upvotes: 1