Can search queries be performed when updating a mapping

I write a plugin for Elasticsearch and I need to know, can search queries and mapping updates run concurrently?

What type of mapping update are you talking about? Can you provide an example/scenario?

I'm talking about Put mapping

What I want to know should I use some kind of synchronization in my plugin?

Elasticsearch does not allow you to change mappings on existing indices which is why I am wondering which type of mapping changes you are referring to.

It do allow. You can add fields, you can change some properties for example search_analyzer, also you can disable norms.

Inside a plugin that implements field type you can decide which properties are allowed to change.

Yeah. You can search while you change things. The field types in the distribution only let you change things that are safe to change. If you write a plugin and make your own fields you can change whatever you think is safe.

I think the mapping changes are atomic on each field on each shard copy. It's been a few years since I looked though. I could be wrong.

Every mapping change is broadcast to everyone node in the cluster. So you shouldn't do it all the time, but you certainly can change what you have to change.

The nodes will change the mapping on their own time so if you send a search request while changing the mapping some shards copies could use the old mapping and others the new mapping.

1 Like