# Simple and query

**URL:** <https://discuss.elastic.co/t/simple-and-query/11312>\
**Category:** Elasticsearch\
**Created:** [March 26, 2013, 10:15am UTC](https://discuss.elastic.co/t/simple-and-query/11312 "2013-03-26T10:15:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens\_Christian\_Groh](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@Jens\_Christian\_Groh](https://discuss.elastic.co/u/Jens_Christian_Groh)\
**Post date:** [March 26, 2013, 10:15am UTC](https://discuss.elastic.co/t/simple-and-query/11312/1 "2013-03-26T10:15:09Z")

</div>

Hi togehter,

i just try to make a simple query which gets the data from two fields with  
an "AND" conjunction.

Looks like

"query":{  
"filtered" : {  
"query":[{

```
                "field":{
                            "Status":"defining"    
                },
                "field":{
                    "Project":"123"
            }
                }
            ]
        }

    }

```

But it just set the last field as parameter.

I also tried it with one field and a filter but it never had a working  
syntax.  
Does anybody have a hint for me?!

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![q42jaap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/q42jaap/32/2241_2.png) [@q42jaap](https://discuss.elastic.co/u/q42jaap)\
**Post date:** [March 26, 2013, 2:34pm UTC](https://discuss.elastic.co/t/simple-and-query/11312/2 "2013-03-26T14:34:16Z")

</div>

Maybe you could post the server log?

Anyway, I believe you should use a boolean query:

"query":{  
"bool" : {  
must: [

```
                "field":{
                            "Status":"defining"
                },
                "field":{
                    "Project":"123"
            }

            ]
        }

    }

```

give or take some {'s or }'s

Jaap Taal

[Q42 BV | tel 070 44523 42 | direct 070 44523 65 | [http://q42.nl](http://q42.nl) |  
Waldorpstraat 17F, Den Haag | Vijzelstraat 72 unit 4.23, Amsterdam | KvK  
30164662 ]

On Tue, Mar 26, 2013 at 11:15 AM, Jens Christian Groh [groh@dtis.eu](mailto:groh@dtis.eu) wrote:

> Hi togehter,
> 
> i just try to make a simple query which gets the data from two fields with  
> an "AND" conjunction.
> 
> Looks like
> 
> "query":{  
> "filtered" : {  
> "query":[{
> 
> ```
> "field":{
> "Status":"defining"
> },
> "field":{
> "Project":"123"
> }
> }
> ]
> }
> 
> }
> 
> ```
> 
> But it just set the last field as parameter.
> 
> I also tried it with one field and a filter but it never had a working  
> syntax.  
> Does anybody have a hint for me?!
> 
> Thanks.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jens\_Christian\_Groh](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@Jens\_Christian\_Groh](https://discuss.elastic.co/u/Jens_Christian_Groh)\
**Post date:** [March 26, 2013, 5:26pm UTC](https://discuss.elastic.co/t/simple-and-query/11312/3 "2013-03-26T17:26:01Z")

</div>

Tanks for your answer,

I took the ".untouched" option and set filter to "term".  
Now it is working.

Am Dienstag, 26. März 2013 11:15:09 UTC+1 schrieb Jens Christian Groh:

> Hi togehter,
> 
> i just try to make a simple query which gets the data from two fields with  
> an "AND" conjunction.
> 
> Looks like
> 
> "query":{  
> "filtered" : {  
> "query":[{
> 
> ```
> "field":{
> "Status":"defining"    
> },
> "field":{
> "Project":"123"
> }
> }
> ]
> }
> 
> }
> 
> ```
> 
> But it just set the last field as parameter.
> 
> I also tried it with one field and a filter but it never had a working  
> syntax.  
> Does anybody have a hint for me?!
> 
> Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:44am UTC](https://discuss.elastic.co/t/simple-and-query/11312/4 "2017-07-06T02:44:22Z")

</div>


