simple and query

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

simple and query

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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: simple and query

q42jaap
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 | Waldorpstraat 17F, Den Haag | Vijzelstraat 72 unit 4.23, Amsterdam | KvK 30164662 ]


On Tue, Mar 26, 2013 at 11:15 AM, Jens Christian Groh <[hidden email]> 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 [hidden email].
For more options, visit 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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: simple and query

Jens Christian Groh
In reply to this post by Jens Christian Groh
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.