Using AND in query string


(Mohit Anchlia) #1

Is there a easy way to give a "AND" clause in the _search?q= query string?


(David Pilato) #2

Use something like q=+term1 +term2
It should work

HTH
David

Le 30 mai 2012 à 19:08, Mohit Anchlia mohitanchlia@gmail.com a écrit :

Is there a easy way to give a "AND" clause in the _search?q= query string?et


(Mohit Anchlia) #3

On Wed, May 30, 2012 at 11:11 AM, David Pilato david@pilato.fr wrote:

Use something like q=+term1 +term2
It should work

I tried this. I am pretty sure I am doing something wrong here :slight_smile:

curl -XGET 'http://dslg1:9200/documents/object/_search?q=+20+EAAgfyaxpzdfcfv9Qexq1WtGvA'

curl: (52) Empty reply from server

My document that I expect to match is something like:

{ "attributes" : [
{ "base64" : true,
"encrypted" : true,
"name" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="
},
{ "base64" : false,
"encrypted" : false,
"age" : "32"
}
],
"version" : 1337298622093
}

HTH
David

Le 30 mai 2012 à 19:08, Mohit Anchlia mohitanchlia@gmail.com a écrit :

Is there a easy way to give a "AND" clause in the _search?q= query
string?et


(David Pilato) #4

Try to encode URL

Something like %20 instead of space...
%xx (i don't remember it) instead of plus sign.

David

Le 30 mai 2012 à 20:25, Mohit Anchlia mohitanchlia@gmail.com a écrit :

On Wed, May 30, 2012 at 11:11 AM, David Pilato david@pilato.fr wrote:
Use something like q=+term1 +term2
It should work

I tried this. I am pretty sure I am doing something wrong here :slight_smile:

curl -XGET 'http://dslg1:9200/documents/object/_search?q=+20 +EAAgfyaxpzdfcfv9Qexq1WtGvA'

curl: (52) Empty reply from server

My document that I expect to match is something like:

{ "attributes" : [
{ "base64" : true,
"encrypted" : true,
"name" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="
},
{ "base64" : false,
"encrypted" : false,
"age" : "32"
}
],
"version" : 1337298622093
}

HTH
David

Le 30 mai 2012 à 19:08, Mohit Anchlia mohitanchlia@gmail.com a écrit :

Is there a easy way to give a "AND" clause in the _search?q= query string?et


(Mohit Anchlia) #5

Is there a way to explicitly say name:abc AND age:2?

On Wed, May 30, 2012 at 11:53 AM, David Pilato david@pilato.fr wrote:

Try to encode URL

Something like %20 instead of space...
%xx (i don't remember it) instead of plus sign.

David

Le 30 mai 2012 à 20:25, Mohit Anchlia mohitanchlia@gmail.com a écrit :

On Wed, May 30, 2012 at 11:11 AM, David Pilato david@pilato.fr wrote:

Use something like q=+term1 +term2
It should work

I tried this. I am pretty sure I am doing something wrong here :slight_smile:

curl -XGET 'http://dslg1:9200/documents/object/_search?q=+20+EAAgfyaxpzdfcfv9Qexq1WtGvA'

curl: (52) Empty reply from server

My document that I expect to match is something like:

{ "attributes" : [
{ "base64" : true,
"encrypted" : true,
"name" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="
},
{ "base64" : false,
"encrypted" : false,
"age" : "32"
}
],
"version" : 1337298622093
}

HTH
David

Le 30 mai 2012 à 19:08, Mohit Anchlia mohitanchlia@gmail.com a écrit :

Is there a easy way to give a "AND" clause in the _search?q= query
string?et


(David Pilato) #6

I use : +name:abc +age:2

Le 30 mai 2012 à 20:58, Mohit Anchlia mohitanchlia@gmail.com a écrit :

Is there a way to explicitly say name:abc AND age:2?

On Wed, May 30, 2012 at 11:53 AM, David Pilato david@pilato.fr wrote:
Try to encode URL

Something like %20 instead of space...
%xx (i don't remember it) instead of plus sign.

David

Le 30 mai 2012 à 20:25, Mohit Anchlia mohitanchlia@gmail.com a écrit :

On Wed, May 30, 2012 at 11:11 AM, David Pilato david@pilato.fr wrote:
Use something like q=+term1 +term2
It should work

I tried this. I am pretty sure I am doing something wrong here :slight_smile:

curl -XGET 'http://dslg1:9200/documents/object/_search?q=+20 +EAAgfyaxpzdfcfv9Qexq1WtGvA'

curl: (52) Empty reply from server

My document that I expect to match is something like:

{ "attributes" : [
{ "base64" : true,
"encrypted" : true,
"name" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="
},
{ "base64" : false,
"encrypted" : false,
"age" : "32"
}
],
"version" : 1337298622093
}

HTH
David

Le 30 mai 2012 à 19:08, Mohit Anchlia mohitanchlia@gmail.com a écrit :

Is there a easy way to give a "AND" clause in the _search?q= query string?et


(system) #7