- Is it possible to use wildcards ( ‘*’ , ‘%’ etc. ) in listWorkflowExecutions() ?
- Is it possible to listWorkflowExecutions() based on whether a specific search attribute is present or not ?
- is there any way I can listWorkflowExecutions() all workflows on a Temporal server ?
For 1. Yes you can do it for search attributes that have the “String” type. You can run
tctl cluster get-search-attributes
to see all available search attributes and their types.
If you had a search attribute “ProductId” of type string:
tctl admin cluster add-search-attributes --name ProductId --type String
with possible values like “book abc”, “book xyz” you could run query:
ProductId LIKE "book%"
If search attribute value was for example “my favorite book”
you could search for example
ProductId LIKE "%favorite%"
Note that search is currently word based, meaning that if the value of your search attribute is a single word, you will need to search for its entire value. and cannot at this time use partial matches with “LIKE”.
This is something that will be added in the future.
For 2. Yes you can use
MySearchAttribute IS NOT NULL MySearchAttribute IS NULL
For 3. You have to set the namespace on ListWorkflowExecutionsRequest so you can list all workflows per namespace (don’t specify a query). To list all, I would assume you could iterate over all namespaces you have, get workflows for that namespace, and accumulate.
Big thanks Tikomir
Exactly what I wanted to know