If I try to write a filtered query through sense, it allows me to just add
a filter and query is not a mandatory field. For example:
{
"query": {
"filtered": {
"filter": {
"term": {
"response_timestamp": "2015-01-01"
}
}
}
}
is a valid query through sense. However, if I try to implement the same
through JAVA API, I have to use the abstract class QueryBuilders.java and
its method:
Please note that here FilterBuilder argument is nullable and QueryBuilder
argument is not. Which means that eventually I have to write a query inside
the Filtered part. If this correct, then how can I write a complete query
with aggregations such that I don't want any score to be calculated and the
response time is faster?
If I try to write a filtered query through sense, it allows me to just add a filter and query is not a mandatory field. For example:
{
"query": {
"filtered": {
"filter": {
"term": {
"response_timestamp": "2015-01-01"
}
}
}
}
is a valid query through sense. However, if I try to implement the same through JAVA API, I have to use the abstract class QueryBuilders.java and its method:
Please note that here FilterBuilder argument is nullable and QueryBuilder argument is not. Which means that eventually I have to write a query inside the Filtered part. If this correct, then how can I write a complete query with aggregations such that I don't want any score to be calculated and the response time is faster?
I don't need the query part. All I need is a filter.
Not sure how matchAllQuery will help.
On Tuesday, 10 February 2015 16:14:51 UTC+5:30, David Pilato wrote:
Use a matchAllQuery for the query part.
All scores will be set to 1.
--
David
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
Le 10 févr. 2015 à 11:24, piyush goyal <coolpi...@gmail.com <javascript:>>
a écrit :
Hi All,
If I try to write a filtered query through sense, it allows me to just add
a filter and query is not a mandatory field. For example:
{
"query": {
"filtered": {
"filter": {
"term": {
"response_timestamp": "2015-01-01"
}
}
}
}
is a valid query through sense. However, if I try to implement the same
through JAVA API, I have to use the abstract class QueryBuilders.java and
its method:
Please note that here FilterBuilder argument is nullable and QueryBuilder
argument is not. Which means that eventually I have to write a query inside
the Filtered part. If this correct, then how can I write a complete query
with aggregations such that I don't want any score to be calculated and the
response time is faster?
If I try to write a filtered query through sense, it allows me to just
add a filter and query is not a mandatory field. For example:
{
"query": {
"filtered": {
"filter": {
"term": {
"response_timestamp": "2015-01-01"
}
}
}
}
is a valid query through sense. However, if I try to implement the same
through JAVA API, I have to use the abstract class QueryBuilders.java and
its method:
Please note that here FilterBuilder argument is nullable and QueryBuilder
argument is not. Which means that eventually I have to write a query inside
the Filtered part. If this correct, then how can I write a complete query
with aggregations such that I don't want any score to be calculated and the
response time is faster?
If I try to write a filtered query through sense, it allows me to just add a filter and query is not a mandatory field. For example:
{
"query": {
"filtered": {
"filter": {
"term": {
"response_timestamp": "2015-01-01"
}
}
}
}
is a valid query through sense. However, if I try to implement the same through JAVA API, I have to use the abstract class QueryBuilders.java and its method:
Please note that here FilterBuilder argument is nullable and QueryBuilder argument is not. Which means that eventually I have to write a query inside the Filtered part. If this correct, then how can I write a complete query with aggregations such that I don't want any score to be calculated and the response time is faster?
But does that mean, if my rest query through sense does not have any query
part and only has a filter part, by default ES adds a matchAll Query to the
query part. So one more question, might be I am asking a wrong question but
just to clear up my doubts.
So now this query will do separate things:
1.) What a normal match all query does.
2.) What ever my filter operations are there, the query will perform the
same as well.
And then ES picks up the intersection of two. Am I right?
Regards
Piyush
On Wednesday, 11 February 2015 12:25:43 UTC+5:30, David Pilato wrote:
If I try to write a filtered query through sense, it allows me to just
add a filter and query is not a mandatory field. For example:
{
"query": {
"filtered": {
"filter": {
"term": {
"response_timestamp": "2015-01-01"
}
}
}
}
is a valid query through sense. However, if I try to implement the same
through JAVA API, I have to use the abstract class QueryBuilders.java and
its method:
Please note that here FilterBuilder argument is nullable and
QueryBuilder argument is not. Which means that eventually I have to write a
query inside the Filtered part. If this correct, then how can I write a
complete query with aggregations such that I don't want any score to be
calculated and the response time is faster?
But does that mean, if my rest query through sense does not have any query part and only has a filter part, by default ES adds a matchAll Query to the query part. So one more question, might be I am asking a wrong question but just to clear up my doubts.
So now this query will do separate things:
1.) What a normal match all query does.
2.) What ever my filter operations are there, the query will perform the same as well.
And then ES picks up the intersection of two. Am I right?
If I try to write a filtered query through sense, it allows me to just add a filter and query is not a mandatory field. For example:
{
"query": {
"filtered": {
"filter": {
"term": {
"response_timestamp": "2015-01-01"
}
}
}
}
is a valid query through sense. However, if I try to implement the same through JAVA API, I have to use the abstract class QueryBuilders.java and its method:
Please note that here FilterBuilder argument is nullable and QueryBuilder argument is not. Which means that eventually I have to write a query inside the Filtered part. If this correct, then how can I write a complete query with aggregations such that I don't want any score to be calculated and the response time is faster?
Ok. That helps a lot in getting the things but still I do feel, since ES is
internally marking the query as MatchAll query, the method definition
should have Nullable query as well.
Thanks once again for helping out.
Regards
Piyush
On Wednesday, 11 February 2015 13:29:32 UTC+5:30, David Pilato wrote:
Actually in a filtered query, filters are applied first.
The match all query then only said that all filtered documents match.
David
Le 11 févr. 2015 à 08:30, piyush goyal <coolpi...@gmail.com <javascript:>>
a écrit :
Ahh.. Now I got you.
But does that mean, if my rest query through sense does not have any query
part and only has a filter part, by default ES adds a matchAll Query to the
query part. So one more question, might be I am asking a wrong question but
just to clear up my doubts.
So now this query will do separate things:
1.) What a normal match all query does.
2.) What ever my filter operations are there, the query will perform the
same as well.
And then ES picks up the intersection of two. Am I right?
Regards
Piyush
On Wednesday, 11 February 2015 12:25:43 UTC+5:30, David Pilato wrote:
If I try to write a filtered query through sense, it allows me to just
add a filter and query is not a mandatory field. For example:
{
"query": {
"filtered": {
"filter": {
"term": {
"response_timestamp": "2015-01-01"
}
}
}
}
is a valid query through sense. However, if I try to implement the same
through JAVA API, I have to use the abstract class QueryBuilders.java and
its method:
Please note that here FilterBuilder argument is nullable and
QueryBuilder argument is not. Which means that eventually I have to write a
query inside the Filtered part. If this correct, then how can I write a
complete query with aggregations such that I don't want any score to be
calculated and the response time is faster?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.