# Shadow replica without predefined mapping

**URL:** <https://discuss.elastic.co/t/shadow-replica-without-predefined-mapping/28232>\
**Category:** Elasticsearch\
**Created:** [August 28, 2015, 8:15am UTC](https://discuss.elastic.co/t/shadow-replica-without-predefined-mapping/28232 "2015-08-28T08:15:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmyjones2](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@jimmyjones2](https://discuss.elastic.co/u/jimmyjones2)\
**Post date:** [August 28, 2015, 8:15am UTC](https://discuss.elastic.co/t/shadow-replica-without-predefined-mapping/28232/1 "2015-08-28T08:15:55Z")

</div>

The [shadow replica documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shadow-replicas.html) has to following warning:

> Because shadow replicas do not index the document on replica shards, it’s  
> possible for the replica’s known mapping to be behind the index’s known mapping  
> if the latest cluster state has not yet been processed on the node containing  
> the replica. Because of this, it is highly recommended to use pre-defined  
> mappings when using shadow replicas.

I've got two questions:

1. What is the maximum amount of time a replica can be behind the latest mapping (1 refresh interval, 60s, 1 day?)
2. What is the implication of a replica mapping being behind the latest mapping? Will queries including that field work as if it wasn't there, will a fatal error be thrown, etc?

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [August 28, 2015, 11:51am UTC](https://discuss.elastic.co/t/shadow-replica-without-predefined-mapping/28232/2 "2015-08-28T11:51:58Z")

</div>

> [@jimmyjones2](#):
>
> What is the maximum amount of time a replica can be behind the latest mapping (1 refresh interval, 60s, 1 day?)

it's usually a cluster-state update behind. It should be a matter of seconds though. This problem is less or not relevant in 2.0 (2.0.0-beta1 just got released) since we wait on the primary for the cluster-state to be published on the replicas.

> [@jimmyjones2](#):
>
> What is the implication of a replica mapping being behind the latest mapping? Will queries including that field work as if it wasn't there, will a fatal error be thrown, etc?

the point of shadow replicas is that you don't use them necessarily for realtime search. Today you need a shared FS to use them at all and changes are only visible once you `_flush` your data to disk. That said the mapping updates should make it to the replica by the time they are searched. If you refresh all the time and flush all the time shadow replicas is not the right tool for you. If the field is not there I think the query will just return less docs.

---

<div class="post-metadata">

**Author:** ![jimmyjones2](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@jimmyjones2](https://discuss.elastic.co/u/jimmyjones2)\
**Post date:** [August 28, 2015, 9:02pm UTC](https://discuss.elastic.co/t/shadow-replica-without-predefined-mapping/28232/3 "2015-08-28T21:02:43Z")

</div>

Thanks Simon!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:53pm UTC](https://discuss.elastic.co/t/shadow-replica-without-predefined-mapping/28232/4 "2017-07-05T23:53:14Z")

</div>


