diff --git a/.gitignore b/.gitignore
index f0dc4092..5ca59c96 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,6 @@ server.pid
activator-*.sbt
node_modules
cerebro.db
+
+# Ignore metals
+metals.sbt
diff --git a/app/models/overview/ClosedIndex.scala b/app/models/overview/ClosedIndex.scala
index 00dc6702..72b33dc5 100644
--- a/app/models/overview/ClosedIndex.scala
+++ b/app/models/overview/ClosedIndex.scala
@@ -1,6 +1,6 @@
package models.overview
-import play.api.libs.json.{JsBoolean, JsString, Json}
+import play.api.libs.json.{JsBoolean, JsFalse, JsString, Json}
object ClosedIndex {
@@ -8,7 +8,8 @@ object ClosedIndex {
Json.obj(
"name" -> JsString(name),
"closed" -> JsBoolean(true),
- "special" -> JsBoolean(name.startsWith("."))
+ "special" -> JsBoolean(name.startsWith(".")),
+ "complete" -> JsFalse
)
}
diff --git a/app/models/overview/ClusterOverview.scala b/app/models/overview/ClusterOverview.scala
index 95d77cd1..b5b93280 100644
--- a/app/models/overview/ClusterOverview.scala
+++ b/app/models/overview/ClusterOverview.scala
@@ -1,13 +1,15 @@
package models.overview
+import java.lang.{ Boolean => JBoolean }
+
import play.api.libs.json._
object ClusterOverview {
def apply(clusterState: JsValue, nodesStats: JsValue, indicesStats: JsValue,
clusterSettings: JsValue, aliases: JsValue, clusterHealth: JsValue,
- nodesInfo: JsValue): JsValue = {
- val indices = buildIndices(clusterState, indicesStats, aliases)
+ nodesInfo: JsValue, indexingCompleteSettings: JsValue): JsValue = {
+ val indices = buildIndices(clusterState, indicesStats, aliases, indexingCompleteSettings)
val masterNodeId = (clusterState \ "master_node").as[String]
@@ -31,6 +33,7 @@ object ClusterOverview {
"total_indices" -> JsNumber(indices.size),
"closed_indices" -> JsNumber(indices.count { idx => (idx \ "closed").as[Boolean] }),
"special_indices" -> JsNumber(indices.count { idx => (idx \ "special").as[Boolean] }),
+ "complete_indices" -> JsNumber(indices.count { idx => (idx \ "complete").as[Boolean] }),
"indices" -> JsArray(indices),
"nodes" -> buildNodes(masterNodeId, nodesInfo, nodesStats),
"shard_allocation" -> JsBoolean(shardAllocation)
@@ -46,17 +49,20 @@ object ClusterOverview {
}.toSeq
)
- def buildIndices(clusterState: JsValue, indicesStats: JsValue, aliases: JsValue): Seq[JsValue] = {
+ def buildIndices(clusterState: JsValue, indicesStats: JsValue, aliases: JsValue, indexingCompleteSettings: JsValue): Seq[JsValue] = {
val routingTable = (clusterState \ "routing_table" \ "indices").as[JsObject].value
val blocks = (clusterState \ "blocks" \ "indices").asOpt[JsObject].getOrElse(Json.obj())
val stats = (indicesStats \ "indices").asOpt[JsObject].getOrElse(Json.obj())
+ val completed = indexingCompleteSettings.as[JsObject].value.collect {
+ case (idx, value) if (value \\ "indexing_complete").map(ic => JBoolean.parseBoolean(ic.as[JsString].value)).exists(_ == true) => idx
+ }.toSet
val indices = routingTable.map { case (index, shards) =>
// Since stats and blocks are JsObject objects potentially big, it's checked that key exists in that object.
// This way, it avoids building a JsUndefined instance with a big string as explained in #467
val indexStats = if (stats.value contains index) (stats \ index).asOpt[JsObject].getOrElse(Json.obj()) else Json.obj()
val indexBlock = if (blocks.value contains index ) (blocks \ index).asOpt[JsObject].getOrElse(Json.obj()) else Json.obj()
val indexAliases = (aliases \ index \ "aliases").asOpt[JsObject].getOrElse(Json.obj()) // 1.4 < does not return aliases obj
- Index(index, indexStats, shards, indexAliases, indexBlock)
+ Index(index, indexStats, shards, indexAliases, indexBlock, if (completed(index)) JsTrue else JsFalse)
}.toSeq
val closedIndices = blocks.value.collect { // ES < 7.X does not return routing_table for closed indices
diff --git a/app/models/overview/Index.scala b/app/models/overview/Index.scala
index fcc1b28e..69940dc6 100644
--- a/app/models/overview/Index.scala
+++ b/app/models/overview/Index.scala
@@ -4,13 +4,14 @@ import play.api.libs.json._
object Index {
- def apply(name: String, stats: JsValue, routingTable: JsValue, aliases: JsValue, indexBlock: JsObject): JsValue = {
+ def apply(name: String, stats: JsValue, routingTable: JsValue, aliases: JsValue, indexBlock: JsObject, indexingComplete: JsBoolean): JsValue = {
val shardMap = createShardMap(routingTable)
JsObject(Seq(
"name" -> JsString(name),
"closed" -> isClosed(indexBlock),
"special" -> JsBoolean(name.startsWith(".")),
+ "complete" -> indexingComplete,
"unhealthy" -> JsBoolean(isIndexUnhealthy(shardMap)),
"doc_count" -> (stats \ "primaries" \ "docs" \ "count").asOpt[JsNumber].getOrElse(JsNumber(0)),
"deleted_docs" -> (stats \ "primaries" \ "docs" \ "deleted").asOpt[JsNumber].getOrElse(JsNumber(0)),
diff --git a/app/services/overview/OverviewDataService.scala b/app/services/overview/OverviewDataService.scala
index c0d0c988..3f350323 100644
--- a/app/services/overview/OverviewDataService.scala
+++ b/app/services/overview/OverviewDataService.scala
@@ -20,7 +20,8 @@ class OverviewDataService @Inject()(client: ElasticClient) {
"_cluster/settings",
"_aliases",
"_cluster/health",
- s"_nodes/_all/os,jvm?human=true"
+ "_nodes/_all/os,jvm?human=true",
+ "_all/_settings/index.lifecycle.indexing_complete"
)
Future.sequence(apis.map(client.executeRequest("GET", _, None, target))).map { responses =>
responses.zipWithIndex.find(_._1.isInstanceOf[Error]) match {
@@ -35,7 +36,8 @@ class OverviewDataService @Inject()(client: ElasticClient) {
responses(3).body, // cluster settings
responses(4).body, // aliases
responses(5).body, // cluster health
- responses(6).body // nodes
+ responses(6).body, // nodes
+ responses(7).body // indexing_complete
)
}
}
diff --git a/public/js/app.js b/public/js/app.js
index 9223ff24..6e260dd8 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -1136,9 +1136,11 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.initializing_shards = 0;
$scope.closed_indices = 0;
$scope.special_indices = 0;
+ $scope.complete_indices = 0;
$scope.shardAllocation = true;
- $scope.indices_filter = new IndexFilter('', false, false, true, true, 0);
+ $scope.indices_filter =
+ new IndexFilter('', false, false, false, true, true, 0);
$scope.nodes_filter = new NodeFilter('', true, false, false, false, 0);
$scope.getPageSize = function() {
@@ -1181,6 +1183,7 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.initializing_shards = data.initializing_shards;
$scope.closed_indices = data.closed_indices;
$scope.special_indices = data.special_indices;
+ $scope.complete_indices = data.complete_indices;
$scope.shardAllocation = data.shard_allocation;
if (!$scope.unassigned_shards &&
!$scope.relocating_shards &&
@@ -1198,6 +1201,7 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.initializing_shards = 0;
$scope.closed_indices = 0;
$scope.special_indices = 0;
+ $scope.complete_indices = 0;
$scope.shardAllocation = true;
}
);
@@ -2310,10 +2314,11 @@ function GroupedSettings(settings) {
this.groups = Object.values(groups);
}
-function IndexFilter(name, closed, special, healthy, asc, timestamp) {
+function IndexFilter(name, closed, special, complete, healthy, asc, timestamp) {
this.name = name;
this.closed = closed;
this.special = special;
+ this.complete = complete;
this.healthy = healthy;
this.sort = 'name';
this.asc = asc;
@@ -2340,6 +2345,7 @@ function IndexFilter(name, closed, special, healthy, asc, timestamp) {
this.name,
this.closed,
this.special,
+ this.complete,
this.healthy,
this.asc,
this.timestamp
@@ -2352,6 +2358,7 @@ function IndexFilter(name, closed, special, healthy, asc, timestamp) {
this.name === other.name &&
this.closed === other.closed &&
this.special === other.special &&
+ this.complete === other.complete &&
this.healthy === other.healthy &&
this.asc === other.asc &&
this.timestamp === other.timestamp
@@ -2363,6 +2370,7 @@ function IndexFilter(name, closed, special, healthy, asc, timestamp) {
!this.name &&
this.closed &&
this.special &&
+ this,complete &&
this.healthy &&
this.asc
);
@@ -2370,6 +2378,9 @@ function IndexFilter(name, closed, special, healthy, asc, timestamp) {
this.matches = function(index) {
var matches = true;
+ if (!this.complete && index.complete) {
+ matches = false;
+ }
if (!this.special && index.special) {
matches = false;
}
diff --git a/public/overview.html b/public/overview.html
index de666f10..d137c17e 100644
--- a/public/overview.html
+++ b/public/overview.html
@@ -8,20 +8,27 @@
ng-model-options='{ debounce: 250 }'
placeholder="filter indices by name or aliases">
-
diff --git a/src/app/components/overview/controller.js b/src/app/components/overview/controller.js
index 4ac8d808..018cc18f 100644
--- a/src/app/components/overview/controller.js
+++ b/src/app/components/overview/controller.js
@@ -13,9 +13,11 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.initializing_shards = 0;
$scope.closed_indices = 0;
$scope.special_indices = 0;
+ $scope.complete_indices = 0;
$scope.shardAllocation = true;
- $scope.indices_filter = new IndexFilter('', false, false, true, true, 0);
+ $scope.indices_filter =
+ new IndexFilter('', false, false, false, true, true, 0);
$scope.nodes_filter = new NodeFilter('', true, false, false, false, 0);
$scope.getPageSize = function() {
@@ -58,6 +60,7 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.initializing_shards = data.initializing_shards;
$scope.closed_indices = data.closed_indices;
$scope.special_indices = data.special_indices;
+ $scope.complete_indices = data.complete_indices;
$scope.shardAllocation = data.shard_allocation;
if (!$scope.unassigned_shards &&
!$scope.relocating_shards &&
@@ -75,6 +78,7 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.initializing_shards = 0;
$scope.closed_indices = 0;
$scope.special_indices = 0;
+ $scope.complete_indices = 0;
$scope.shardAllocation = true;
}
);
diff --git a/src/app/shared/index_filter.js b/src/app/shared/index_filter.js
index fd92f2b0..ea8a453f 100644
--- a/src/app/shared/index_filter.js
+++ b/src/app/shared/index_filter.js
@@ -1,7 +1,8 @@
-function IndexFilter(name, closed, special, healthy, asc, timestamp) {
+function IndexFilter(name, closed, special, complete, healthy, asc, timestamp) {
this.name = name;
this.closed = closed;
this.special = special;
+ this.complete = complete;
this.healthy = healthy;
this.sort = 'name';
this.asc = asc;
@@ -28,6 +29,7 @@ function IndexFilter(name, closed, special, healthy, asc, timestamp) {
this.name,
this.closed,
this.special,
+ this.complete,
this.healthy,
this.asc,
this.timestamp
@@ -40,6 +42,7 @@ function IndexFilter(name, closed, special, healthy, asc, timestamp) {
this.name === other.name &&
this.closed === other.closed &&
this.special === other.special &&
+ this.complete === other.complete &&
this.healthy === other.healthy &&
this.asc === other.asc &&
this.timestamp === other.timestamp
@@ -51,6 +54,7 @@ function IndexFilter(name, closed, special, healthy, asc, timestamp) {
!this.name &&
this.closed &&
this.special &&
+ this,complete &&
this.healthy &&
this.asc
);
@@ -58,6 +62,9 @@ function IndexFilter(name, closed, special, healthy, asc, timestamp) {
this.matches = function(index) {
var matches = true;
+ if (!this.complete && index.complete) {
+ matches = false;
+ }
if (!this.special && index.special) {
matches = false;
}
diff --git a/test/models/overview/ClusterInitializingShards.scala b/test/models/overview/ClusterInitializingShards.scala
index 6e817b79..68bad1de 100644
--- a/test/models/overview/ClusterInitializingShards.scala
+++ b/test/models/overview/ClusterInitializingShards.scala
@@ -4,7 +4,7 @@ import play.api.libs.json.Json
object ClusterInitializingShards {
- def apply() = ClusterOverview(clusterState, nodesStats, indicesStats, clusterSettings, aliases, clusterHealth, nodes)
+ def apply() = ClusterOverview(clusterState, nodesStats, indicesStats, clusterSettings, aliases, clusterHealth, nodes, indexingComplete)
val clusterState = Json.parse(
"""
@@ -577,4 +577,5 @@ object ClusterInitializingShards {
""".stripMargin
)
+ val indexingComplete = Json.obj()
}
diff --git a/test/models/overview/ClusterRelocatingShards.scala b/test/models/overview/ClusterRelocatingShards.scala
index 8a0725b4..707e4782 100644
--- a/test/models/overview/ClusterRelocatingShards.scala
+++ b/test/models/overview/ClusterRelocatingShards.scala
@@ -709,6 +709,8 @@ object ClusterRelocatingShards extends ClusterStub {
""".stripMargin
)
+ val indexingComplete = Json.obj()
+
val main = Json.parse(
"""
|{
diff --git a/test/models/overview/ClusterStub.scala b/test/models/overview/ClusterStub.scala
index caaed945..245b2bbb 100644
--- a/test/models/overview/ClusterStub.scala
+++ b/test/models/overview/ClusterStub.scala
@@ -4,7 +4,7 @@ import play.api.libs.json.JsValue
trait ClusterStub {
- def apply() = ClusterOverview(clusterState, nodesStats, indicesStats, clusterSettings, aliases, clusterHealth, nodes)
+ def apply() = ClusterOverview(clusterState, nodesStats, indicesStats, clusterSettings, aliases, clusterHealth, nodes, indexingComplete)
val clusterState: JsValue
@@ -20,4 +20,5 @@ trait ClusterStub {
val nodes: JsValue
+ val indexingComplete: JsValue
}
diff --git a/test/models/overview/ClusterWithData.scala b/test/models/overview/ClusterWithData.scala
index 50880ce8..0ac078eb 100644
--- a/test/models/overview/ClusterWithData.scala
+++ b/test/models/overview/ClusterWithData.scala
@@ -125,6 +125,24 @@ trait ClusterWithData extends ClusterStub {
| }
| ]
| }
+ | },
+ | "complete": {
+ | "shards": {
+ | "0": [
+ | {
+ | "state": "STARTED",
+ | "primary": true,
+ | "node": "cPsT9o5FQ3WRnvqSTXHiVQ",
+ | "relocating_node": null,
+ | "shard": 0,
+ | "index": "complete",
+ | "version": 3,
+ | "allocation_id": {
+ | "id": "GtL-xGXKR4eyOhrIYU2YoQ"
+ | }
+ | }
+ | ]
+ | }
| }
| }
| }
@@ -453,6 +471,28 @@ trait ClusterWithData extends ClusterStub {
| "throttle_time_in_millis": 0
| }
| }
+ | },
+ | "complete": {
+ | "primaries": {
+ | "docs": {
+ | "count": 5,
+ | "deleted": 0
+ | },
+ | "store": {
+ | "size_in_bytes": 33620,
+ | "throttle_time_in_millis": 0
+ | }
+ | },
+ | "total": {
+ | "docs": {
+ | "count": 5,
+ | "deleted": 0
+ | },
+ | "store": {
+ | "size_in_bytes": 33620,
+ | "throttle_time_in_millis": 0
+ | }
+ | }
| }
| }
|}
@@ -478,6 +518,9 @@ trait ClusterWithData extends ClusterStub {
| },
| ".foobar": {
| "aliases": {}
+ | },
+ | "complete": {
+ | "aliases": {}
| }
|}
""".stripMargin
@@ -610,6 +653,22 @@ trait ClusterWithData extends ClusterStub {
""".stripMargin
)
+ val indexingComplete = Json.parse(
+ """
+ |{
+ | "complete": {
+ | "settings": {
+ | "index": {
+ | "lifecycle": {
+ | "indexing_complete": "true"
+ | }
+ | }
+ | }
+ | }
+ |}
+ """.stripMargin
+ )
+
val main = Json.parse(
"""
|{
diff --git a/test/models/overview/ClusterWithoutData.scala b/test/models/overview/ClusterWithoutData.scala
index f4756168..64974833 100644
--- a/test/models/overview/ClusterWithoutData.scala
+++ b/test/models/overview/ClusterWithoutData.scala
@@ -439,6 +439,8 @@ object ClusterWithoutData extends ClusterStub {
""".stripMargin
)
+ val indexingComplete = Json.obj()
+
val main = Json.parse(
"""
|{
diff --git a/test/models/overview/IndexSpec.scala b/test/models/overview/IndexSpec.scala
index 85841c7e..8b7dfed1 100644
--- a/test/models/overview/IndexSpec.scala
+++ b/test/models/overview/IndexSpec.scala
@@ -1,7 +1,7 @@
package models.overview
import org.specs2.Specification
-import play.api.libs.json.Json
+import play.api.libs.json.{ JsFalse, JsTrue, Json }
object IndexSpec extends Specification {
@@ -13,6 +13,7 @@ object IndexSpec extends Specification {
build an index with relocating shards $relocating
build an index with unassigned shards $unassigned
build a special index $special
+ build an indexing complete index $indexingComplete
build a closed index $closed
"""
@@ -24,6 +25,7 @@ object IndexSpec extends Specification {
| "name": "ipsum",
| "closed": false,
| "special": false,
+ | "complete": false,
| "unhealthy": false,
| "doc_count": 62064,
| "deleted_docs": 0,
@@ -98,7 +100,7 @@ object IndexSpec extends Specification {
|}
""".stripMargin
)
- val index = Index("ipsum", IndexStats.stats, IndexRoutingTable.healthyShards, IndexAliases.aliases, Json.obj())
+ val index = Index("ipsum", IndexStats.stats, IndexRoutingTable.healthyShards, IndexAliases.aliases, Json.obj(), JsFalse)
index mustEqual expected
}
@@ -109,6 +111,7 @@ object IndexSpec extends Specification {
| "name": "ipsum",
| "closed": false,
| "special": false,
+ | "complete": false,
| "unhealthy": true,
| "doc_count": 62064,
| "deleted_docs": 0,
@@ -192,7 +195,7 @@ object IndexSpec extends Specification {
|}
""".stripMargin
)
- val index = Index("ipsum", IndexStats.stats, IndexRoutingTable.relocatingShard, IndexAliases.aliases, Json.obj())
+ val index = Index("ipsum", IndexStats.stats, IndexRoutingTable.relocatingShard, IndexAliases.aliases, Json.obj(), JsFalse)
index mustEqual expected
}
@@ -203,6 +206,7 @@ object IndexSpec extends Specification {
| "name": "ipsum",
| "closed": false,
| "special": false,
+ | "complete": false,
| "unhealthy": true,
| "doc_count": 62064,
| "deleted_docs": 0,
@@ -285,17 +289,104 @@ object IndexSpec extends Specification {
|}
""".stripMargin
)
- val index = Index("ipsum", IndexStats.stats, IndexRoutingTable.unassignedShard, IndexAliases.aliases, Json.obj())
+ val index = Index("ipsum", IndexStats.stats, IndexRoutingTable.unassignedShard, IndexAliases.aliases, Json.obj(), JsFalse)
index mustEqual expected
}
def special = {
+ val expected = Json.parse(
+ """
+ |{
+ | "name": "ipsum",
+ | "closed": false,
+ | "special": false,
+ | "complete": true,
+ | "unhealthy": false,
+ | "doc_count": 62064,
+ | "deleted_docs": 0,
+ | "size_in_bytes": 163291998,
+ | "total_size_in_bytes": 326583996,
+ | "aliases": [
+ | "fancyAlias"
+ | ],
+ | "num_shards": 5,
+ | "num_replicas": 0,
+ | "shards": {
+ | "ZqGi3UPESiSa0Z4Sf4NlPg": [
+ | {
+ | "state": "STARTED",
+ | "primary": true,
+ | "node": "ZqGi3UPESiSa0Z4Sf4NlPg",
+ | "relocating_node": null,
+ | "shard": 4,
+ | "index": "some",
+ | "allocation_id": {
+ | "id": "oWmBTuCFSuGA4krn5diK3w"
+ | }
+ | },
+ | {
+ | "state": "STARTED",
+ | "primary": true,
+ | "node": "ZqGi3UPESiSa0Z4Sf4NlPg",
+ | "relocating_node": null,
+ | "shard": 1,
+ | "index": "some",
+ | "allocation_id": {
+ | "id": "YUY5QiPmQJulsereqC1VBQ"
+ | }
+ | },
+ | {
+ | "state": "STARTED",
+ | "primary": true,
+ | "node": "ZqGi3UPESiSa0Z4Sf4NlPg",
+ | "relocating_node": null,
+ | "shard": 0,
+ | "index": "some",
+ | "allocation_id": {
+ | "id": "LEm_TRI3TFuH3icSnvkvQg"
+ | }
+ | }
+ | ],
+ | "H-4gqX87SYqmQKtsatg92w": [
+ | {
+ | "state": "STARTED",
+ | "primary": true,
+ | "node": "H-4gqX87SYqmQKtsatg92w",
+ | "relocating_node": null,
+ | "shard": 2,
+ | "index": "some",
+ | "allocation_id": {
+ | "id": "LXEh1othSz6IE5ueTITF-Q"
+ | }
+ | },
+ | {
+ | "state": "STARTED",
+ | "primary": true,
+ | "node": "H-4gqX87SYqmQKtsatg92w",
+ | "relocating_node": null,
+ | "shard": 3,
+ | "index": "some",
+ | "allocation_id": {
+ | "id": "6X6SMPvvQbOdUct5k3bo6w"
+ | }
+ | }
+ | ]
+ | }
+ |}
+ """.stripMargin
+ )
+ val index = Index("ipsum", IndexStats.stats, IndexRoutingTable.healthyShards, IndexAliases.aliases, Json.obj(), JsTrue)
+ index mustEqual expected
+ }
+
+ def indexingComplete = {
val expected = Json.parse(
"""
|{
| "name": ".ipsum",
| "closed": false,
| "special": true,
+ | "complete": false,
| "unhealthy": false,
| "doc_count": 62064,
| "deleted_docs": 0,
@@ -370,7 +461,7 @@ object IndexSpec extends Specification {
|}
""".stripMargin
)
- val index = Index(".ipsum", IndexStats.stats, IndexRoutingTable.healthyShards, IndexAliases.aliases, Json.obj())
+ val index = Index(".ipsum", IndexStats.stats, IndexRoutingTable.healthyShards, IndexAliases.aliases, Json.obj(), JsFalse)
index mustEqual expected
}
@@ -381,6 +472,7 @@ object IndexSpec extends Specification {
| "name": "ipsum",
| "closed": true,
| "special": false,
+ | "complete": false,
| "unhealthy": false,
| "doc_count": 62064,
| "deleted_docs": 0,
@@ -455,7 +547,7 @@ object IndexSpec extends Specification {
|}
""".stripMargin
)
- val index = Index("ipsum", IndexStats.stats, IndexRoutingTable.healthyShards, IndexAliases.aliases, IndexBlocks.closed)
+ val index = Index("ipsum", IndexStats.stats, IndexRoutingTable.healthyShards, IndexAliases.aliases, IndexBlocks.closed, JsFalse)
index mustEqual expected
}
diff --git a/tests/common/index_filter.js b/tests/common/index_filter.js
index fda669a1..6efecd81 100644
--- a/tests/common/index_filter.js
+++ b/tests/common/index_filter.js
@@ -1,95 +1,107 @@
QUnit.test("Filters out special indices", function(assert) {
- var filter = new IndexFilter("", true, false, true, true, 0);
+ var filter = new IndexFilter("", true, false, true, true, true, 0);
var index = {name: "index_name", closed: false, special: true, unhealthy: false, aliases: []};
assert.ok(!filter.matches(index), "Filters out special indices");
})
QUnit.test("Maintains special indices", function(assert) {
- var filter = new IndexFilter("", true, true, true, true, 0);
+ var filter = new IndexFilter("", true, true, true, true, true, 0);
var index = {name: "index_name", closed: false, special: true, unhealthy: false, aliases: []};
assert.ok(filter.matches(index), "Filters out special indices");
})
QUnit.test("Filters out closed indices", function(assert) {
- var filter = new IndexFilter("", false, true, true, true, 0);
+ var filter = new IndexFilter("", false, true, true, true, true, 0);
var index = {name: "index_name", closed: true, special: false, unhealthy: false, aliases: []};
assert.ok(!filter.matches(index), "Filters out closed indices");
})
QUnit.test("Maintains closed indices", function(assert) {
- var filter = new IndexFilter("", true, true, true, true, 0);
+ var filter = new IndexFilter("", true, true, true, true, true, 0);
var index = {name: "index_name", closed: true, special: false, unhealthy: false, aliases: []};
assert.ok(filter.matches(index), "Filters out closed indices");
})
+QUnit.test("Filters out complete indices", function(assert) {
+ var filter = new IndexFilter("", true, true, false, true, true, 0);
+ var index = {name: "index_name", closed: false, special: false, complete: true, unhealthy: false, aliases: []};
+ assert.ok(!filter.matches(index), "Filters out complete indices");
+})
+
+QUnit.test("Maintains complete indices", function(assert) {
+ var filter = new IndexFilter("", true, true, true, true, true, 0);
+ var index = {name: "index_name", closed: false, special: false, complete: true, unhealthy: false, aliases: []};
+ assert.ok(filter.matches(index), "Filters out complete indices");
+})
+
QUnit.test("Maintains healthy indices", function(assert) {
- var filter = new IndexFilter("", true, true, true, true, 0);
+ var filter = new IndexFilter("", true, true, true, true, true, 0);
var index = {name: "index_name", closed: true, special: false, unhealthy: false, aliases: []};
assert.ok(filter.matches(index), "Maintains healthy indices");
})
QUnit.test("Maintains unhealthy indices", function(assert) {
- var filter = new IndexFilter("", true, true, true, true, 0);
+ var filter = new IndexFilter("", true, true, true, true, true, 0);
var index = {name: "index_name", closed: true, special: false, unhealthy: true, aliases: []};
assert.ok(filter.matches(index), "Maintains unhealthy indices");
})
QUnit.test("Filters out healthy indices", function(assert) {
- var filter = new IndexFilter("", true, true, false, true, 0);
+ var filter = new IndexFilter("", true, true, true, false, true, 0);
var index = {name: "index_name", closed: true, special: false, unhealthy: false, aliases: []};
assert.ok(!filter.matches(index), "Filters out healthy indices");
})
QUnit.test("Filter by name on different name index", function(assert) {
- var filter = new IndexFilter("abc", true, true, true, true, 0);
+ var filter = new IndexFilter("abc", true, true, true, true, true, 0);
var index = {name: "cba", closed: true, special: false, unhealthy: false, aliases: []};
assert.ok(!filter.matches(index), "Doesnt match if filter name is not a substring of name");
})
QUnit.test("Filter by name on index with matching name", function(assert) {
- var filter = new IndexFilter("abc", true, true, true, true, 0);
+ var filter = new IndexFilter("abc", true, true, true, true, true, 0);
var index = {name: "abcdef", closed: true, special: false, unhealthy: false, aliases: []};
assert.ok(filter.matches(index), "Matches if filter name is a substring of name");
})
QUnit.test("Filter by name regexp on index with matching name", function(assert) {
- var filter = new IndexFilter("a\.+f", true, true, true, true, 0);
+ var filter = new IndexFilter("a\.+f", true, true, true, true, true, 0);
var index = {name: "abcdef", closed: true, special: false, unhealthy: false, aliases: []};
assert.ok(filter.matches(index), "Matches if filter reg exp matches index name");
})
QUnit.test("Use regexp as plain string if regexp doesnt compile", function(assert) {
- var filter = new IndexFilter("a\.f-", true, true, true, true, 0);
+ var filter = new IndexFilter("a\.f-", true, true, true, true, true, 0);
var index = {name: "a.f-", closed: true, special: false, unhealthy: false, aliases: []};
assert.ok(filter.matches(index), "Matches if filter reg exp matches index name");
})
QUnit.test("Use regexp as plain string if regexp doesnt compile", function(assert) {
- var filter = new IndexFilter("a\.f-", true, true, true, true, 0);
+ var filter = new IndexFilter("a\.f-", true, true, true, true, true, 0);
var index = {name: "a.f-", closed: true, special: false, unhealthy: false, aliases: []};
assert.ok(filter.matches(index), "Matches if filter non compiling reg exp matches index name");
})
QUnit.test("Checks also index aliases for matches", function(assert) {
- var filter = new IndexFilter("also", true, true, true, true, 0);
+ var filter = new IndexFilter("also", true, true, true, true, true, 0);
var index = {name: "a.f-", closed: true, special: false, unhealthy: false, aliases: ["whatever", "also_aliases"]};
assert.ok(filter.matches(index), "Matches also on index aliases");
})
QUnit.test("Checks also index aliases for matches if RegExp doesnt compile", function(assert) {
- var filter = new IndexFilter("[a\.f-", true, true, true, true, 0);
+ var filter = new IndexFilter("[a\.f-", true, true, true, true, true, 0);
var index = {name: "a.f-", closed: true, special: false, unhealthy: false, aliases: ["somethingelse", "[a\.f-lalala"]};
assert.ok(filter.matches(index), "Matches also on index aliases if regexp doesnt compile");
})
QUnit.test("Doesnt match if neither name or aliases match the RegExp", function(assert) {
- var filter = new IndexFilter("[a\.f-", true, true, true, true, 0);
+ var filter = new IndexFilter("[a\.f-", true, true, true, true, true, 0);
var index = {name: "a.f-", closed: true, special: false, unhealthy: false, aliases: ["ddd"]};
assert.ok(!filter.matches(index), "Matches also on index aliases if regexp doesnt compile");
})
QUnit.test("Doesnt match if neither name or aliases match the text", function(assert) {
- var filter = new IndexFilter("bbbb", true, true, true, true, 0);
+ var filter = new IndexFilter("bbbb", true, true, true, true, true, 0);
var index = {name: "a.f-", closed: true, special: false, unhealthy: false, aliases: ["ddd"]};
assert.ok(!filter.matches(index), "Matches also on index aliases if regexp doesnt compile");
})