Is Facet affects the Filtered Query Result?

Hi ,

I am Using Filtered Query With Facet.
My query Structure is as Following :

{
"query": {
"filtered": {

        },
        "filter": {
            
            }
    },
   "facets": {
        "abc": {
            "terms": {
                "script_field": 

"doc["content_data"].value+"+"+doc["content_date"].value"
}
}
}
}

Here , I am Using Script Fields for my Java API to get Respected Records.
When i add One more Element in Script field with "+" , the results i get
are different .
So , is Script Field in Facet affects the Actual Query result or Facet is
just for Grouping ?

Please Suggest me , i am confused !!

Thanks ,
Aniruddha

--
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.

Hi,

Facets don't affect the hits which are matched by your query. Changing your
faceting script only changes the faceting part of the response.

On Wed, Sep 11, 2013 at 5:26 PM, Aniruddha Pol aniruddhapol1@gmail.comwrote:

Hi ,

I am Using Filtered Query With Facet.
My query Structure is as Following :

{
"query": {
"filtered": {

        },
        "filter": {

            }
    },
   "facets": {
        "abc": {
            "terms": {
                "script_field":

"doc["content_data"].value+"+"+doc["content_date"].value"
}
}
}
}

Here , I am Using Script Fields for my Java API to get Respected Records.
When i add One more Element in Script field with "+" , the results i get
are different .
So , is Script Field in Facet affects the Actual Query result or Facet is
just for Grouping ?

Please Suggest me , i am confused !!

Thanks ,
Aniruddha

--
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.

--
Adrien Grand

--
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.

Thanks Adrien .

I have one more query regarding to Facet :

In facet i am using Fields[] with size 0.
"fields": [],
"from": 0,
"size": 0,
"facets":
{
}

Every time its returning me 10 records for each Query.
So , is it Default value or anywhere i am going wrong.
Please suggest.

Thanks ,
Aniruddha

You should not see any records for that query. Perhaps asking for an empty
array of fields causes a bug? Can you gist the query and the output?

--
Ivan

On Thu, Sep 12, 2013 at 12:16 AM, AniruddhaPol aniruddhapol1@gmail.comwrote:

Thanks Adrien .

I have one more query regarding to Facet :

In facet i am using Fields with size 0.
"fields": ,
"from": 0,
"size": 0,
"facets":
{
}

Every time its returning me 10 records for each Query.
So , is it Default value or anywhere i am going wrong.
Please suggest.

Thanks ,
Aniruddha

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Is-Facet-affects-the-Filtered-Query-Result-tp4041016p4041048.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.

Hi ,

The Query is Like :

{
"query": {
"filtered": {
"query": {
"query_string": {
"default_field": "Users",
"query": "Ani"
}
},
"filter": {
"bool": {
"must": [
{
"terms": {
"City": [
"Pune",
"Mumbai",
"Delhi"
]
}
},
{
"terms": {
"gender": [
"male",
"female",
"unknown"
]
}
}
]
}
}
}
},
"fields": [],
"from": 0,
"size": 0,
"facets": {
"City_Facet": {
"terms": {
"field": "city"
}
}
}
}

It always giving me 10 records , please review and suggest if i am wrong anywhere ?

Thanks,
Aniruddha

Trying to wrap my head around this issue. When you say the query is giving
you 10 records, what exactly do you mean? 10 hits returned? Total hit count
of 10? 10 buckets in your facet?

I modified your query with fields that match my data, and requesting size:0
and fields: returns the expected result:

"hits": {
"total": 150,
"max_score": 15.479453,
"hits":
},

I'm on elasticsearch 0.90.2

--
Ivan

On Tue, Sep 24, 2013 at 7:42 AM, AniruddhaPol aniruddhapol1@gmail.comwrote:

Hi ,

The Query is Like :

*{
"query": {
"filtered": {
"query": {
"query_string": {
"default_field": "Users",
"query": "Ani"
}
},
"filter": {
"bool": {
"must": [
{
"terms": {
"City": [
"Pune",
"Mumbai",
"Delhi"
]
}
},
{
"terms": {
"gender": [
"male",
"female",
"unknown"
]
}
}
]
}
}
}
},
"fields": ,
"from": 0,
"size": 0,
"facets": {
"City_Facet": {
"terms": {
"field": "city"
}
}
}
} *

It always giving me 10 records , please review and suggest if i am wrong
anywhere ?

Thanks,
Aniruddha

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Is-Facet-affects-the-Filtered-Query-Result-tp4041016p4041761.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.

Hi Ivan ,

Yes , it always returns 10 buckets in my Facet .
When i tried for following it gives me more than 10 buckets in my Facet.
So my question , is facet by default returns 10 buckets in Facet ?

,
"fields": [],
"from": 0,
"size": 0,
"facets": {
"City_Facet": {
"terms": {
"field": "city",
"size" : 20
}
}
}

Thanks,
Aniruddha

Now I understand the last issue better. Your query is not returning 10
documents, it is your facet returning 10 buckets.

Yes, 10 is the default bucket size for the terms facet. As you discovered,
you can change the value by using the size attribute. AFAIK, it is not
possible to return all values.

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/terms/TermsFacetParser.java#L84

Cheers,

Ivan

On Wed, Sep 25, 2013 at 11:46 PM, AniruddhaPol aniruddhapol1@gmail.comwrote:

Hi Ivan ,

Yes , it always returns 10 buckets in my Facet .
When i tried for following it gives me more than 10 buckets in my Facet.
So my question , * is facet by default returns 10 buckets in Facet ?*

,
"fields": ,
"from": 0,
"size": 0,
"facets": {
"City_Facet": {
"terms": {
"field": "city",
"size" : 20
}
}
}

Thanks,
Aniruddha

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Is-Facet-affects-the-Filtered-Query-Result-tp4041016p4041826.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.

Thanks Ivan for your Reply.
Its really helpful for me .

Is there any way to get all values from Facet ?

Please suggest.

Thanks,
Aniruddha

Hi ,

Will default count also applicable to Query Part also without using Facet ?

Thanks,
Aniruddha

As mentioned previously, there is no way to retrieve all the values.

The default query size is different from the default facet size, both of
which default to 10.

--
Ivan

On Thu, Oct 10, 2013 at 7:57 AM, AniruddhaPol aniruddhapol1@gmail.comwrote:

Hi ,

Will default count also applicable to Query Part also without using Facet ?

Thanks,
Aniruddha

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Is-Facet-affects-the-Filtered-Query-Result-tp4041016p4042372.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.