# Custom search fields

**URL:** <https://community.temporal.io/t/custom-search-fields/2262>\
**Category:** Community Support\
**Tags:** go-sdk\
**Created:** [May 27, 2021, 5:40pm UTC](https://community.temporal.io/t/custom-search-fields/2262 "2021-05-27T17:40:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidL](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@DavidL](https://community.temporal.io/u/DavidL)\
**Post date:** [May 27, 2021, 5:40pm UTC](https://community.temporal.io/t/custom-search-fields/2262/1 "2021-05-27T17:40:58Z")

</div>

I’m having difficulty executing a search on custom fields.  
When I execute the following in temporal-web I receive zero results, I expect one result:  
`WorkflowType = "ChangeName" AND CloseTime = missing AND AND PersonId ="123"`

Removing the PersonId predicate yields the one result I expected from the previous query, which has this in its history (trimmed for brevity):

```
"eventType": "UpsertWorkflowSearchAttributes",
"details": {
  "workflowTaskCompletedEventId": "4",
  "searchAttributes": {
    “PersonId": "\"123\"",
  },

```

I also tried:  
`WorkflowType = "ChangeName" AND CloseTime = missing AND AND PersonId =“\”123\””`

The setup for this included adding the following to the bottom of development\_es.yaml  
`PersonId: “Keyword”`

Temporal started with:  
`docker-compose -f docker-compose-cas-es.yml up`

I start the workflow with the following options:

```
workflowOptions := client.StartWorkflowOptions{
	ID: workflowId,
	TaskQueue: taskQueue,
	SearchAttributes: map[string]interface{}{
		“PersonId": personId,
	},
}

```

Using v1.9.2.

What am I missing to have the search work as expected? Any other info I can provide to help troubleshoot?

Thank you.

---

<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:** [May 27, 2021, 7:42pm UTC](https://community.temporal.io/t/custom-search-fields/2262/2 "2021-05-27T19:42:48Z")

</div>

First of all, you have double `AND AND` in the query but I guess it is just a typo because Web UI will give you:

```auto
3 INVALID_ARGUMENT: Invalid query

```

in this case.

Did you modify Elasticsearch schema? Adding search attribute to dynamic config is not enough with `1.9.2`. You also need to add this field manually to `Attr` property in the ES schema. You can either modify [schema template](https://github.com/temporalio/temporal/blob/v1.9.2/schema/elasticsearch/v7/visibility/index_template.json#L46) and [recreate the index](https://github.com/temporalio/temporal/blob/v1.9.2/Makefile#L346), or add this field [manually](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html). I understand inconvenience and it will be changed with next release.
