Is the Custom Search attributes global or for namespace specific?

when we add custom search attributes through tctl , will that be global i.e. all name space workflow can upsert it? if so is there any way to create it for namespace specific? our use case is we have multiple team uses same temporal but they have their own namespace. So having their own custom search attribute will be better for us.

They are per cluster. You add them using tctl admin cluster add-search-attributes command which implies cluster level. The reason behind this that the single Elasticsearch index is shared between namespaces and there is a limitation on number of fields Elasticsearch can handle efficiently.

There is a way to support it on namespace level though but you will need to build your own server. You will need to implement mapper interface and pass the instance using server option. Your implementation can store alias<->field name mapping per namespace. This will allow users to use aliases instead of field names.

Let’s say you create a cluster level custom search attribute Attribute1 and map it to ProductId in Namespace1 and to OrderId in Namespace2. Although data will be stored in the same field Attribute1 users of these namespaces could use different names for it.