Closed mbeaufre closed 2 weeks ago
Hello! Thank you for your question. In the future, I would prefer Markdown code blocks rather than screenshots of code, as they are easier to work with, even when working in a notebook.
If I understand correctly, what you're seeing is:
es.indices.exist(index="...-data-2024-11-12")
returns False
es.indices.exist(index="...-data-2024-11-12*")
returns True
es.indices.exist(index="...-data-2024-11-1*")
returns True
If yes, then that's not evidence of the wildcard support failing. I believe you don't have an index named ...-data-2024-11-12
(which is why the first call returns False), but you probably have an index named like ...-data-2024-11-12-001
, which is why the two other calls return True.
To confirm that theory you can use es.indices.get(index="...-data-2024-11-12*")
(docs) and you will see which indices match.
I just saw your edit, and can confirm the behavior. Looking into it more, thank you.
Digging into it a bit more, I realized that you need to use allow_no_indices=False
to get the behavior you want. The default behavior is definitely confusing, but was kept this way to not break backward compatibility and be consistent with the Get Index API that also returns 200 OK when no indices match with a wildcard.
es.indices.exists(index="...-data-2024-11-12*", allow_no_indices=False)
I'm going to go ahead and close this, but I would still be happy to know if that fixed your problem or not. And I can always reopen if needed.
Hello !
Sorry about the non-markdown format, noted for the next time. Thanks for your help, it worked.
I read the doc of the exists
function but didn't understand that allow_no_indices
did what I wanted.
Merci !
In the documentation: Documentation of exists function
It is written that exists method supports wildcards ('*'). My screenshot aim to prove that it doesn't, in version 8.14 and lilkely later versions, since it was already written in the documentation for release 8.14.0 it had the support for wildcards.
Just for the context: This index doesn't exists, neither does a variation of its name.