Copy To: Order and Whitespace Separation


(drjz) #1

I have 2 fields: FirstName and SurName, which I want to concatenate during index time by a single whitespace. I wonder whether it is possible to merge the value of both fields to a single field with Elasticsearch? Or does this need to be merged before indexing by some kind of preprocessor?


(Nik Everett) #2

copy_to is really best for if you don't want the thing in your _source field. It sounds like you want to index them together so it'd be better to merge them in the _source you submit.

Just thinking about it, I'd advise you to toss the concept of first name and surname because not all folks have first names. Some people have only one name and some people's first names are actually their family names and their second name is their given name. Names are hard regardless of elasticsearch.


(system) #3