elastic4s icon indicating copy to clipboard operation
elastic4s copied to clipboard

`indexExists` always returns `true` if index string contains `*`

Open tastyminerals opened this issue 2 years ago • 2 comments

There seems to be a bug with indexExists and wildcards.

client.execute {
  indexExists("asdsadasd")
}.await.result.isExists // false
client.execute {
  indexExists("asdsadasd*")
}.await.result.isExists // true

tastyminerals avatar Feb 23 '24 18:02 tastyminerals

If I try it in Kibana, I get the same result. So, it's standard Elasticsearch behaviour. https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html. Might be a bug though, it seems to me that your expectations are correct.

Philippus avatar Apr 03 '24 18:04 Philippus

You can set the allow_no_indices parameter to false to get the required behaviour, something like:

client.execute {
  indexExists("asdsadasd*").copy(indicesOptions = Some(IndicesOptionsRequest(allowNoIndices = false)))
}.await.result.isExists

Philippus avatar May 05 '24 17:05 Philippus