List Workflow with customized Search Attributes not working

Hi team,

The default Search Attributes query is working for me, but not working when I query new added Search Attributes.

I’m able to see all the indexed filed from the command line, but when I tried query, it’s not working, can you please help check, is something was missing from my end? thank you in advance.

query by runid is working
bash-5.0# tctl wf list -q “RunId=‘2dbc2881-08ea-4fa3-9aff-dfc779094d3e’” --print_search_attr
WORKFLOW TYPE | WORKFLOW ID | RUN ID | TASK QUEUE | START TIME | EXECUTION TIME | END TIME | SEARCH ATTRIBUTES
AppZenWorkflow | a0b76f19aff044899c809be8645ce9ad__8e92c612-639d-44e0-b769-8773c6d8a818 | 2dbc2881-08ea-4fa3-9aff-dfc779094d3e | AppZenTest | 19:42:06 | 19:42:06 | 19:42:10 | ProcessStatus=enabled ProcessState=published
| | | | | | | ProcessName=invoice ProcessISPublic=true
| | | | | | | ProcessID=a0b76f19aff044899c809be8645ce9ad
| | | | | | | ProcessCreatorAccountId=3232
| | | | | | | BinaryChecksums=[1ba3767fed7b2a2052b24c7eb49c82d3]
| | | | | | |

query by customized Search Attributes not working

bash-5.0# tctl wf list -q “ProcessStatus=‘enabled’” --print_search_attr
WORKFLOW TYPE | WORKFLOW ID | RUN ID | TASK QUEUE | START TIME | EXECUTION TIME | END TIME | SEARCH ATTRIBUTES

Thanks
Gaoxin

Hi Gaoxin,

Can you describe the process you used to register the new Search Attribute to your cluster? I am assuming you followed the directions here: https://docs.temporal.io/docs/filter-workflows

Can you also print out the list of registered Search Attributes for your cluster using this command:

tctl --namespace samples-namespace cl get-search-attr

Thanks,
Manu

Thank you Manu for checking.

I updated the dynamicconfig development_es.yaml with my own attributes.

** And I tried two different ways to register search attributes.**

  1. upsert in workflow.

_ = workflow.UpsertSearchAttributes(ctx, w.SearchAttributes)

  1. start workflow with SearchAttributes option
    workflowOptions := client.StartWorkflowOptions{
    ID: processID + “__” + uuid.New(),
    TaskQueue: test,
    SearchAttributes: SearchAttributes,
    }

Here is the output of registered attributes:
bash-5.0# tctl --namespace default cl get-search-attr
±------------------------±-----------+
| KEY | VALUE TYPE |
±------------------------±-----------+
| BinaryChecksums | Keyword |
| CloseTime | Int |
| CustomBoolField | Bool |
| CustomDatetimeField | Datetime |
| CustomDoubleField | Double |
| CustomIntField | Int |
| CustomKeywordField | Keyword |
| CustomNamespace | Keyword |
| CustomStringField | String |
| CustomerID | Keyword |
| Encoding | Keyword |
| ExecutionStatus | Int |
| ExecutionTime | Int |
| HistoryLength | Int |
| InvoiceID | Keyword |
| KafkaKey | Keyword |
| NamespaceId | Keyword |
| Operator | Keyword |
| ProcessCreatorAccountId | Keyword |
| ProcessID | Keyword |
| ProcessISPublic | Bool |
| ProcessName | Keyword |
| ProcessState | Keyword |
| ProcessStatus | Keyword |
| RolloutId | Keyword |
| RunId | Keyword |
| StartTime | Int |
| TaskQueue | Keyword |
| TemporalChangeVersion | Keyword |
| WorkflowId | Keyword |
| WorkflowType | Keyword |
| addon | Keyword |
| addon-type | Keyword |
| environment | Keyword |
| project | Keyword |
| service | Keyword |
| user | Keyword |
±------------------------±-----------+

Hey Gaoxin,

Did you also update schema/elasticsearch/visibility/index_template.json for the additional attributes you want indexed?

I only updated dynamicconfig file development_es.yaml. Can you please guid me how to update other config files? Thank you in advance.

Thanks
Gaoxin

Hey Gaoxin,

That’s the only other file you have to update. Follow the same pattern in that file that was used to register the CustomStringField/CustomBoolField properties to register the properties that you want indexed. For instance, in mappings.properties.Attr.properties, add an entry for each property. Example:

"ProcessState": { "type": "keyword"},

We acknowledge that this is not the best experience in the world. We are looking at how to make this intuitive / easier in the future.

Thanks,
Manu

1 Like

Thank you very much Manu, this works for me.

Hi Manu,

I am trying to add a customer search attribute. Is there any new way other than adding attributes in the file schema/elasticsearch/visibility/index_template.json ?

Thanks
Rajat

You can use tctl, for example:

tctl adm cl asa -n MyCustomAttribute -t Text

You can get the list of all search attributes with:

tctl cl gsa