Query for all indices in a cluster


#1

Hi,
In Elasticsearch 6.x, there is a call to es.indices.get_alias to get all the indices in a given alias. Is there a method to get all indices that are not associated with any alias. My purpose is to clean up those indices that are not associated with any alias.
Thanks,


(Zachary Tong) #2

Not that I'm aware of. You can get a list of all the indices (Cat Indices, Get Index, etc), but I can't think of an API that returns only the indices that don't have an associated alias.

I think you'll have to get the list of indices, then the list of aliases and their associated indices, and intersect the two sets client-side.


#3

Thanks, I can use curl to get the indices as you suggested. Does it have any way to get indices that match a certain pattern in Python?

curl -X GET "localhost:9200/1234*"


#4

I found out that you can get all the indices that match a pattern as
es.indices.get(index="1234*")


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.