Skip to content

rollover max_docs uses doc count from both primary and replica/s #24217

@jpcarey

Description

@jpcarey

Elasticsearch version: 5.3.0

The rollover max_docs value uses the doc count from both primary and replica/s. It should be based upon the primary only, since the replica count can be changed.

(start two nodes, to allow the default 1 replica to allocate)

PUT /logs-000001 
{
  "aliases": {
    "logs_write": {}
  }
}
PUT logs_write/test/1
{
  "blah": "foo"
}
POST /logs_write/_rollover?dry_run
{
  "conditions": {
    "max_docs":  2
  }
}
# response
{
  "old_index": "logs-000001",
  "new_index": "logs-000002",
  "rolled_over": false,
  "dry_run": true,
  "acknowledged": false,
  "shards_acknowledged": false,
  "conditions": {
    "[max_docs: 2]": true
  }
}

change the replica count to 0:

PUT /logs-000001/_settings
{
  "index": {
    "number_of_replicas": 0
  }
}
# response
{
  "old_index": "logs-000001",
  "new_index": "logs-000002",
  "rolled_over": false,
  "dry_run": true,
  "acknowledged": false,
  "shards_acknowledged": false,
  "conditions": {
    "[max_docs: 2]": false
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions