# Elasticsearch queries with multiple conditions not working?

**URL:** https://community.temporal.io/t/elasticsearch-queries-with-multiple-conditions-not-working/1942
**Category:** Community Support
**Tags:** elasticsearch
**Created:** [April 16, 2021, 5:08pm UTC](https://community.temporal.io/t/elasticsearch-queries-with-multiple-conditions-not-working/1942 "2021-04-16T17:08:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jmac](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jmac/32/303_2.png) [@jmac](https://community.temporal.io/u/jmac)
#### Post date: [April 16, 2021, 5:08pm UTC](https://community.temporal.io/t/elasticsearch-queries-with-multiple-conditions-not-working/1942/1 "2021-04-16T17:08:18Z")

</div>

I’m trying to use tctl (1.8.2) to list my workflows based on multiple criteria, but it seems like only the first condition of the where clause is being honored. Example: This search seems to run correctly:

```
tctl wf list --query 'WorkflowType="CreateConfigurationWorkflow"'

```

Whereas this one does not seem to apply the second condition:

```
tctl wf list --query 'WorkflowType="CreateConfigurationWorkflow" AND WorkflowID="c7341eab-a73d-4af3-9fda-c5fa2301efdf"'

```

Am I formatting the query incorrectly?

---

<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: [April 16, 2021, 10:26pm UTC](https://community.temporal.io/t/elasticsearch-queries-with-multiple-conditions-not-working/1942/2 "2021-04-16T22:26:36Z")

</div>

With you second query you should get an error:

```auto
Error: Failed to list workflow.
Error Details: invalid search attribute

```

And this is because search attributes names are case sensitive. `WorkflowID` should be `WorkflowId`.

---

<div class="post-metadata">

### Author: ![jmac](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jmac/32/303_2.png) [@jmac](https://community.temporal.io/u/jmac)
#### Post date: [April 17, 2021, 1:10pm UTC](https://community.temporal.io/t/elasticsearch-queries-with-multiple-conditions-not-working/1942/3 "2021-04-17T13:10:25Z")

</div>

Honestly, it looks like I can put _anything_ there and I don’t receive any errors… it only cares about the first condition. This does not throw an error for me…

```
tctl wf list --query 'WorkflowType="CreateConfigurationWorkflow" AND dsfgdfsgsdg_ ahflawe ljfha '
```

---

<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: [April 19, 2021, 5:04pm UTC](https://community.temporal.io/t/elasticsearch-queries-with-multiple-conditions-not-working/1942/4 "2021-04-19T17:04:15Z")

</div>

Is your server version is also 1.8.2? What is visibility persistence? Cas or MySQL or ES?

---

<div class="post-metadata">

### Author: ![jmac](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jmac/32/303_2.png) [@jmac](https://community.temporal.io/u/jmac)
#### Post date: [April 19, 2021, 6:51pm UTC](https://community.temporal.io/t/elasticsearch-queries-with-multiple-conditions-not-working/1942/5 "2021-04-19T18:51:46Z")

</div>

Yes, the server is 1.8.2 as well. We are using Cassandra for “visibilityStore” and ES for “advancedVisibilityStore”.

---

<div class="post-metadata">

### Author: ![jmac](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jmac/32/303_2.png) [@jmac](https://community.temporal.io/u/jmac)
#### Post date: [April 19, 2021, 7:12pm UTC](https://community.temporal.io/t/elasticsearch-queries-with-multiple-conditions-not-working/1942/6 "2021-04-19T19:12:13Z")

</div>

Oof, OK, once again I am the victim of my own stupidity. 🤯 I’ve been using a script to run tctl inside of a docker container, and the command line input wasn’t being parsed correctly. Disregard, and sorry to waste your time!

---

<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: [April 19, 2021, 7:13pm UTC](https://community.temporal.io/t/elasticsearch-queries-with-multiple-conditions-not-working/1942/7 "2021-04-19T19:13:16Z")

</div>

Great! Because I just checked out exact 1.8.2 and wasn’t able to reproduce it.
