Bool query problem


(Slava G ) #1

Hi,
Trying to execute query :
{
"bool" : {
"must" : [ {
"match" : {
"_all" : {
"query" : "Any text that don't exists",
"type" : "phrase"
}
}
}, {
"term" : {
"account" : "slava.test@gmail.com"
}
}, {
"term" : {
"source" : "gmail"
}
} ]
}
}

But always get a result, even the text in the match query does not exists
in any indexed document.

What I do wrong ?

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.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

Could you gist a full curl recreation?
Hard to tell without all details.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 22 novembre 2013 at 10:21:29, slavag (slavago@gmail.com) a écrit:

Hi,
Trying to execute query :
{
"bool" : {
"must" : [ {
"match" : {
"_all" : {
"query" : "Any text that don't exists",
"type" : "phrase"
}
}
}, {
"term" : {
"account" : "slava.test@gmail.com"
}
}, {
"term" : {
"source" : "gmail"
}
} ]
}
}

But always get a result, even the text in the match query does not exists in any indexed document.

What I do wrong ?

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.
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Slava G ) #3

Hi David,
Actually this is from the java code (the query build
with BoolQueryBuilder). When I execute it by curl :
url -XGET 'localhost:9200/6e5bde01-94c2-44c8-a339-ee8ece640e39/_search/' -d
'{
"query" : {
"bool" : {
"must" : [ {
"match" : {
"_all" : {
"query" : "muku",
"type" : "phrase"
}
}
}, {
"term" : {
"account" : "slava.test@gmail.com"
}
}, {
"term" : {
"source" : "gmail"
}
} ]
}
}
}
}'

It's working fine - no result returned. But when it's via java code it's
returned many results. Please note that all inside "query" is taken from
the query object in Java.

Thanks

On Friday, November 22, 2013 11:28:30 AM UTC+2, David Pilato wrote:

Could you gist a full curl recreation?
Hard to tell without all details.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonethttps://www.google.com/url?q=https%3A%2F%2Ftwitter.com%2Fdadoonet&sa=D&sntz=1&usg=AFQjCNE-DMC3YEu3X_lhRIhUzuSZGsaSqA
| @elasticsearchfrhttps://www.google.com/url?q=https%3A%2F%2Ftwitter.com%2Felasticsearchfr&sa=D&sntz=1&usg=AFQjCNGfXdQ98RWFMJXdiqpKnZb5GMg0zA

Le 22 novembre 2013 at 10:21:29, slavag (sla...@gmail.com <javascript:>)
a écrit:

Hi,
Trying to execute query :
{
"bool" : {
"must" : [ {
"match" : {
"_all" : {
"query" : "Any text that don't exists",
"type" : "phrase"
}
}
}, {
"term" : {
"account" : "slava...@gmail.com <javascript:>"
}
}, {
"term" : {
"source" : "gmail"
}
} ]
}
}

But always get a result, even the text in the match query does not exists
in any indexed document.

What I do wrong ?

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 elasticsearc...@googlegroups.com <javascript:>.
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #4

I meant a full curl recreation:

Delete index, Create Index, put mapping, put some docs, refresh, query…

See: http://www.elasticsearch.org/help/

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 22 novembre 2013 at 12:43:28, slavag (slavago@gmail.com) a écrit:

Hi David,
Actually this is from the java code (the query build with BoolQueryBuilder). When I execute it by curl :
url -XGET 'localhost:9200/6e5bde01-94c2-44c8-a339-ee8ece640e39/_search/' -d '{
"query" : {
"bool" : {
"must" : [ {
"match" : {
"_all" : {
"query" : "muku",
"type" : "phrase"
}
}
}, {
"term" : {
"account" : "slava.test@gmail.com"
}
}, {
"term" : {
"source" : "gmail"
}
} ]
}
}
}
}'

It's working fine - no result returned. But when it's via java code it's returned many results. Please note that all inside "query" is taken from the query object in Java.

Thanks

On Friday, November 22, 2013 11:28:30 AM UTC+2, David Pilato wrote:
Could you gist a full curl recreation?
Hard to tell without all details.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 22 novembre 2013 at 10:21:29, slavag (sla...@gmail.com) a écrit:

Hi,
Trying to execute query :
{
"bool" : {
"must" : [ {
"match" : {
"_all" : {
"query" : "Any text that don't exists",
"type" : "phrase"
}
}
}, {
"term" : {
"account" : "slava...@gmail.com"
}
}, {
"term" : {
"source" : "gmail"
}
} ]
}
}

But always get a result, even the text in the match query does not exists in any indexed document.

What I do wrong ?

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 elasticsearc...@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5