# Error when add search attributes

**URL:** <https://community.temporal.io/t/error-when-add-search-attributes/1222>\
**Category:** Community Support\
**Created:** [December 23, 2020, 10:26am UTC](https://community.temporal.io/t/error-when-add-search-attributes/1222 "2020-12-23T10:26:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gordon\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_sun/32/82_2.png) [@Gordon\_Sun](https://community.temporal.io/u/Gordon_Sun)\
**Post date:** [December 23, 2020, 10:26am UTC](https://community.temporal.io/t/error-when-add-search-attributes/1222/1 "2020-12-23T10:26:25Z")

</div>

Our cluster deployed using helm chart [https://github.com/temporalio/helm-charts](https://github.com/temporalio/helm-charts)  
When try to add a search attribute we got this error

```
bash-5.0# tctl --namespace default adm cl asa --search_attr_key OrderId2 --search_attr_type keyword
Are you trying to add key [OrderId2] with Type [Keyword]? Y/N y
Error: Add search attribute failed.
Error Details: rpc error: code = Internal desc = Failed to update dynamic config, err: failed to write config file, err: open /etc/temporal/dynamic_config/dynamic_config.yaml: read-only file system.

```

But after that we list it we do see OrderId2 got added  
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 |  
| Encoding | Keyword |  
| ExecutionStatus | Int |  
| ExecutionTime | Int |  
| HistoryLength | Int |  
| KafkaKey | Keyword |  
| NamespaceId | Keyword |  
| Operator | Keyword |  
| OrderId | Keyword |  
| OrderId2 | Keyword |  
| RunId | Keyword |  
| StartTime | Int |  
| TaskQueue | Keyword |  
| TemporalChangeVersion | Keyword |  
| WorkflowId | Keyword |  
| WorkflowType | Keyword |  
| orderId | Keyword |  
| status | Keyword |  
±----------------------±-----------+

But it does not work when we try to use it:  
Caused by: io.grpc.StatusRuntimeException: INVALID\_ARGUMENT: BadSearchAttributes: OrderId2 is not valid search attribute key

[This post](https://community.temporal.io/t/list-workflow-with-customized-search-attributes-not-working/745/2) say something about schema/elasticsearch/visibility/index\_template.json

How do I do it when I’m using helm-chart?

---

<div class="post-metadata">

**Author:** ![alex](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/alex/32/15_2.png) [@alex](https://community.temporal.io/u/alex)\
**Post date:** [December 23, 2020, 5:37pm UTC](https://community.temporal.io/t/error-when-add-search-attributes/1222/2 "2020-12-23T17:37:21Z")

</div>

Hi Gordon.

First of all, custom search attributes are in “beta” stage. I have plans to rewrite underlying logic early next year.  
In your particular case, obvious reason is the dynamic config is read only and can’t be changed. Admin handler change it’s in-memory value and it becomes available for `GetSearchAttributes` API. This is why you can see it with `tctl` but it still doesn’t work because history service is not aware of it.

For now, I would recommend you to manually add search attributes to [dynamic config](https://github.com/temporalio/temporal/blob/master/config/dynamicconfig/development_es.yaml#L7) and to the [schema](https://github.com/temporalio/temporal/blob/master/schema/elasticsearch/visibility/index_template.json#L54) and redeploy it.

---

<div class="post-metadata">

**Author:** ![samar](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/samar/32/12_2.png) [@samar](https://community.temporal.io/u/samar)\
**Post date:** [December 23, 2020, 6:50pm UTC](https://community.temporal.io/t/error-when-add-search-attributes/1222/3 "2020-12-23T18:50:13Z")

</div>

[Here](https://community.temporal.io/t/list-workflow-with-customized-search-attributes-not-working/745/5) which walks through the process of adding your own custom searchable attribute.

---

<div class="post-metadata">

**Author:** ![Gordon\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_sun/32/82_2.png) [@Gordon\_Sun](https://community.temporal.io/u/Gordon_Sun)\
**Post date:** [December 23, 2020, 7:04pm UTC](https://community.temporal.io/t/error-when-add-search-attributes/1222/4 "2020-12-23T19:04:40Z")

</div>

Hi @samar, I saw that post but I cannot figure out how to follow it. We are using helm chart

---

<div class="post-metadata">

**Author:** ![Gordon\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_sun/32/82_2.png) [@Gordon\_Sun](https://community.temporal.io/u/Gordon_Sun)\
**Post date:** [December 23, 2020, 7:30pm UTC](https://community.temporal.io/t/error-when-add-search-attributes/1222/5 "2020-12-23T19:30:43Z")

</div>

Hi @alex

Thank you very much for those 2 links. For the first one, I think I should put it in [https://github.com/temporalio/helm-charts/blob/master/values/values.dynamic\_config.yaml](https://github.com/temporalio/helm-charts/blob/master/values/values.dynamic_config.yaml)

However, I cannot figure out what to do with the 2nd link. What should I do when I’m using helm chart?

Thank you very much!

---

<div class="post-metadata">

**Author:** ![Gordon\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_sun/32/82_2.png) [@Gordon\_Sun](https://community.temporal.io/u/Gordon_Sun)\
**Post date:** [December 23, 2020, 9:51pm UTC](https://community.temporal.io/t/error-when-add-search-attributes/1222/6 "2020-12-23T21:51:49Z")

</div>

I found this [https://github.com/temporalio/temporal/issues/505](https://github.com/temporalio/temporal/issues/505)  
After 15 minutes of reading I’m more confused  
Do I have to clone the repo, modify 2 files, build my own temporal docker image, publish it and use that in my helm chart just to add a search attribute?

---

<div class="post-metadata">

**Author:** ![Gordon\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_sun/32/82_2.png) [@Gordon\_Sun](https://community.temporal.io/u/Gordon_Sun)\
**Post date:** [December 23, 2020, 10:07pm UTC](https://community.temporal.io/t/error-when-add-search-attributes/1222/7 "2020-12-23T22:07:54Z")

</div>

I see the dynamic config was only supported recently [https://github.com/temporalio/helm-charts/commit/d1191c4d0b867d3de918c3e8e863d9b3918f325e](https://github.com/temporalio/helm-charts/commit/d1191c4d0b867d3de918c3e8e863d9b3918f325e)

Is this just a helm chart issue to also have index\_template.json mounted just like the dynamic config?

Or should we directly call ES api to manage its index separately?

Very lost. Please help

---

<div class="post-metadata">

**Author:** ![alex](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/alex/32/15_2.png) [@alex](https://community.temporal.io/u/alex)\
**Post date:** [December 24, 2020, 5:54am UTC](https://community.temporal.io/t/error-when-add-search-attributes/1222/8 "2020-12-24T05:54:09Z")

</div>

2nd link is the ES schema template. Unfortunately, I don’t know much about helm (even ours). I believe when [this](https://github.com/temporalio/helm-charts/blob/master/values.yaml#L296) step is executed it uses existing template which supposed to be uploaded on ES by then. I don’t know how to upload it with helm. During development process I use [install-schema-es](https://github.com/temporalio/temporal/blob/master/Makefile#L385) target which uploads template first and then creates ES index. I hope there is a better way rather then rebuild docker image yourself but this will work for sure.  
As you can see, custom search attributes are not very convenient to use. This is why it is in my short TODO list.
