Lower casing all field names in reindex


(Lars Riis Olsen) #1

Hi,

I have an existing index where there are a lot of 'duplicate' field names due to case sensitivity. I would like to reindex this index so it contains only lower case field names.

Judging from the examples it should be possible using the reindex api and painless:

"ctx._source.tag = ctx._source.remove("Tag")"

However, since my index contains 2000+ fields I would rather not have to hard-code the field names of each and every duplicate field.

Is there a more scalable way to do this so it just automatically lower cases every field in the index?


(Luca Wintergerst) #2

Hi Lars,
I don't have time to type up the correct script right now, but you should be able to do this using HashSets.
Take the content of the source, put it in a set, lowercase the keys and replace the existing source with it.

Sorry that I can't be of more help right now.

Luca


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.