Let's see how it might be done with a simplest case: we have to put JSON formatted data into ElasticSearch for further analysis. So, our purpose is to write Map-only job that will populate ElasticSearch with data from text file (already in JSON).
First of all, let configure Configuration object:
I guess, everything is clear here.
Very important is to set up correct output format, pay attention on register:
After that we will implement Mapper (it emits only value, without key - this behavior is required by ES output format class!):
Let's back to the second code snippet. There is EsOutputFormat, pay attention on register, because there is old deprecated API with ESOutputFormat class.It might be required to add exclusion to Maven file, to pull correct versions of jars and omit dependencies hell: