Index deleted when putMapping is used twice

the putMapping api should merge the mapping of the fields:

but content should stay or are you doing a delete mapping reqest?

Can you track down the issues to some curl or java statements?

and yes, you can also get the current mapping

I would recommend to reindex the data if the mapping changed otherwise
you possibly get wrong mapping merges and incorrect indexed fields...

Regards,
Peter.

On 21 Okt., 09:23, Alexandre azli...@gmail.com wrote:

Hi !

I am developping a small library that integrates Morphia (MongoDB) and
Elasticsearch using the ES java API.
During application startup I use Annotated Entities to generate the ES
index Mapping.

Everything works pretty fine and I am able to create the index, then
analyzers and the type mappings properly . Indexing works great too.

However I have noted that when restarting the application and going
through the index mapping generation process again (using putMapping
API) the content of the index gets deleted.

I do perform a check to see if the index already exists to avoid
recreating it, however, in my Library the mappings are automatically
uploaded each time the app starts which maybe is the problem ...

Is it a normal behavior of ES? Is the content wiped away when type
mappings are redefined, even if they are exactly the same as the
prevoius ones?
Is there a way to get existing mappings and compare them to the ones
I'm about to upload to avoid this problem?

Hope I'm clear enough :slight_smile:

Thanks for your help

Cheers !

Alexandre