Re: Complex query

2014-05-20 Thread Andreas J
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 elasticsearch+unsubscr...@googlegroups.com
> <mailto:elasticsearch+unsubscr...@googlegroups.com>.
> 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 elasticsearch+unsubscr...@googlegroups.com.
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.


Re: Complex query

2014-05-19 Thread Ivan Brusic
I haven't had time to look at your query, but have you looked into
multi-field queries?

http://www.elasticsearch.org/blog/multi-field-search-just-got-better/

-- 
Ivan


On Mon, May 19, 2014 at 12:56 AM, ElasticRookie wrote:

> Hello,
>
> Nobody can help me to find a solution for this query ?
>
> I really need help plz.
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/20f5fa82-0e18-45cf-babd-70a00fbb4e6d%40googlegroups.com
> .
>
> 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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCHhe4M%2BTwrWc2x1VUbNweSWr_%2BrzTNyFEG3rY3MULGkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Complex query

2014-05-19 Thread ElasticRookie
Hello, 

Nobody can help me to find a solution for this query ?

I really need help plz.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/20f5fa82-0e18-45cf-babd-70a00fbb4e6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Complex query

2014-05-16 Thread ElasticRookie
Please, I really need help for this query.

I just created this query but it's a very heavy query 


 {
  "query": {
"match_all": {}
  },
  "filter": {
"and": [
  {
"or": [
  {
"query": {
  "query_string": {
"query": "*Word1*",
"default_field": "name"
  }
}
  },
  {
"query": {
  "query_string": {
"query": "*Word1*",
"default_field": "firstname"
  }
}
  },
  {
"query": {
  "query_string": {
"query": "Word1*",
"default_field": "zipcode"
  }
}
  }
]
  },
  {
"or": [
  {
"query": {
  "query_string": {
"query": "*Wordn*",
"default_field": "name"
  }
}
  },
  {
"query": {
  "query_string": {
"query": "*Wordn*",
"default_field": "firstname"
  }
}
  },
  {
"query": {
  "query_string": {
"query": "Wordn*",
"default_field": "zipcode"
  }
}
  }
]
  }
]
  }
}

If i have ten word, i think the query will be very very very long to be 
execute

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/29359521-cada-41de-beac-1b6d786abbdd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Complex query

2014-05-16 Thread 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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/882034da-08c4-4573-ac1a-c3d929ca1154%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Complex Query

2014-03-18 Thread Yogesh Shetty
I recently downloaded and started exploring elasticsearch and went through 
search api, I am still trying to figure out what is the best way to phrase 
this complex query for eg. what will be the elastic search query look like 
for below conditional operators.

(Source = "Crystal" and ReportName = "BOLI.rpt") Or 
( (ParameterName = "EffDate" And FieldName = "SourceId") Or 
  (ParameterName = "Type" and FieldName = "Cusip" ) )

Do i need to take filter route? or can this be done using query 

thanks in advance

Cheers
Yogesh

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/cc1dcfb6-0fd5-4999-8399-be6e10ae4bc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.