PHPackages                             zumba/elasticsearch-index-rotate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. zumba/elasticsearch-index-rotate

ActiveLibrary[Search &amp; Filtering](/categories/search)

zumba/elasticsearch-index-rotate
================================

Safely rotate indexes with no downtime to end users.

1.2.2(7y ago)1636.7k↓26.9%3MITPHPPHP &gt;=5.5.0CI failing

Since Feb 26Pushed 3mo ago25 watchersCompare

[ Source](https://github.com/zumba/elasticsearch-index-rotator)[ Packagist](https://packagist.org/packages/zumba/elasticsearch-index-rotate)[ RSS](/packages/zumba-elasticsearch-index-rotate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (12)Used By (0)

Elasticsearch Index Rotator
===========================

[](#elasticsearch-index-rotator)

A library to enable you to safely rotate indexes with no downtime to end users.

[![Build Status](https://camo.githubusercontent.com/fd7407281300cbe19a0c8fd99f072bf374392dc3ddd122ee303d27a565696932/68747470733a2f2f7472617669732d63692e6f72672f7a756d62612f656c61737469637365617263682d696e6465782d726f7461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/zumba/elasticsearch-index-rotator)

### Why would I use this?

[](#why-would-i-use-this)

In many situations, Elasticsearch is used as an ephemeral datastore used to take structured or relational data and make it fast to search on that data. Often this is achieved via scheduled jobs that read data from a permanent datastore (such as MySQL or Postgres) and translate it into an Elasticsearch index.

In many cases, rebuilding an index requires a clean slate so that the entire index is rebuilt. How do you do this without interrupting end users searching on that index? The answer is a rotating index.

[![User search disrupted by rebuild](docs/disruption.png)](docs/disruption.png)

> Here the user's search is fully disrupted when the index is first removed, and only partially available while the index is being rebuilt. While the index is being rebuilt, users get incomplete data.

[![User search contiguous](docs/rotation.png)](docs/rotation.png)

> Here the user's search is never disrupted because we construct a new index and after it is built/settled, we change the what index to search by the client.

Installation
------------

[](#installation)

```
composer require zumba/elasticsearch-index-rotate

```

Elasticsearch Index Rotator supports multiple versions of ElasticSearch server and uses the [official elasticsearch](https://packagist.org/packages/elasticsearch/elasticsearch) library for execute the commands. On your application, make sure you include this package as well and specify the version supported by your Elasticsearch server. See the library documentation for the versions.

Usage
-----

[](#usage)

#### Example Search

[](#example-search)

```
