Ningjun
Ningjun

Reputation: 41

Elastic4s: How do I get all index names from ElasticSearch?

I am using Elastic4s. I need to find all index names from an instance of ElasticSearch. What API shall I use?

Upvotes: 4

Views: 845

Answers (3)

Tarang Bhalodia
Tarang Bhalodia

Reputation: 1195

For Elastic4s version: 6.5.0. You can get all the indices using catIndices api provided by Elastic4s.

Here's an example:

val resp = client.execute {
  catIndices
}

You can refer the official doc for more info.

Upvotes: 2

Jayant Chauhan
Jayant Chauhan

Reputation: 173

You can get all index names and details associated with it.

GET _cat/indices?v

Upvotes: 0

sksamuel
sksamuel

Reputation: 16387

In elastic 1.6.5 you can do,

val resp = client.execute {
  clusterState
}

Upvotes: 1

Related Questions