maybe its simpler to make it in just one query_string like this:
curl 'http://127.0.0.1:9200/data/_search' --data
'{"fields":["_parent","_source"],"query":{"bool":{"must": [ {
"simple_query_string": { "query": "_(a|b*) c (x|y)_",
"default_operator": "AND" } }
]}},"from":0,"size":10,"sort":[],"facets":{},"version":true}'
query_string allows really powerful expressions
Am 16.05.2014 15:22, schrieb ElasticRookie:
> Hello community,
> First, I apologize for my English.
>
> I can not find a complex query.
> I have thes columns :
> *Id : String*
> *Name : String*
> *FirstName : String*
> *ZipCode : String*
>
>
> If a user perfoms a query : "*word1 *.... *wordn*"
> I need to make a query, something like this :
>
> Name contains word1 *OR*
> FirstName contains word1 *OR*
> ZipCode starts with word1
> *AND*
> ....
> *AND*
> Name contains wordn *OR*
> FirstName contains wordn *OR*
> ZipCode starts with wordn
>
>
>
> i make this query but it's not my real need :
>
> /{/
> / "query": {/
> / "bool": {/
> / "must": [/
> / {/
> / "query_string": {/
> / "fields": [/
> / "name",/
> / "firstname",/
> / "zipcode"/
> / ],/
> / "query": "*word1*"/
> / }/
> / },/
> / {/
> / "query_string": {/
> / "fields": [/
> / "name",/
> / "firstname",/
> / "zipcode"/
> / ],/
> / "query": "*wordn*"/
> / }/
> / }/
> / ],/
> / "must_not": [],/
> / "should": []/
> / }/
> / },/
> / "from": 0,/
> / "size": 10,/
> / "sort": [],/
> / "facets": {}/
> /} /
>
> This query is not good because I don't have my condition "zipcode
> start with" but "zipcode contains".
>
> Can someone help me build the right query ?
> --
> 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 [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/882034da-08c4-4573-ac1a-c3d929ca1154%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/882034da-08c4-4573-ac1a-c3d929ca1154%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/537B7AB1.2010702%40gmail.com.
For more options, visit https://groups.google.com/d/optout.