Root fields in nested facet filter


(Karthick Duraisamy Soundararaj) #1

This documenthttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html#_all_nested_matching_root_documents shows
how to apply facet_filter on the fields in the nested documents. I want to
be able to apply facet_filter on the root/parent fields while faceting on
the nested fields

{
"category" : "shirts"
"variation" : [
{

"color" : "blue",

"size" : 4

    },
    {

"color" : "green",

"size" : 6

   }
]

}

In the above doc for instance, I want to be able to do something like
below.

{

"query": {

"match_all": {}

},

"facets": {

  "size": {

               "terms": {
                         "field" : "size"
                },
                "nested": "obj1",
                "facet_filter" : {
                        "term" : {"category" : "shirts"}
                 }
         }

}

Is this possible ?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/be67102c-3f46-44cb-a5ed-c52399924451%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #2

It is not possible to filter on the parent/root fields. I have not looked
if this functionality has been added with the new aggregation framework.

Cheers,

Ivan

On Wed, Dec 4, 2013 at 7:40 PM, dsk karthick.soundararaj@gmail.com wrote:

This documenthttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html#_all_nested_matching_root_documents shows
how to apply facet_filter on the fields in the nested documents. I want to
be able to apply facet_filter on the root/parent fields while faceting on
the nested fields

{
"category" : "shirts"
"variation" : [
{

"color" : "blue",

"size" : 4

    },
    {

"color" : "green",

"size" : 6

   }
]

}

In the above doc for instance, I want to be able to do something like
below.

{

"query": {

"match_all": {}

},

"facets": {

  "size": {

               "terms": {
                         "field" : "size"
                },
                "nested": "obj1",
                "facet_filter" : {
                        "term" : {"category" : "shirts"}
                 }
         }

}

Is this possible ?

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/be67102c-3f46-44cb-a5ed-c52399924451%40googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDD_Vx1Ltpo0g%2B_4XDOugQFuq3%3DK51h2ZaV2nFMzR039w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Karthick Duraisamy Soundararaj) #3

I tried aggregations today. I am able to do this
{

"query": {

"match_all": {}

},

"aggs": {

  "size": {

               "filter" : { "range" : { "model" : { "gt" : 2013 } } },
         }

}

On Wed, Dec 4, 2013 at 7:52 PM, Ivan Brusic ivan@brusic.com wrote:

It is not possible to filter on the parent/root fields. I have not looked
if this functionality has been added with the new aggregation framework.

Cheers,

Ivan

On Wed, Dec 4, 2013 at 7:40 PM, dsk karthick.soundararaj@gmail.comwrote:

This documenthttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html#_all_nested_matching_root_documents shows
how to apply facet_filter on the fields in the nested documents. I want to
be able to apply facet_filter on the root/parent fields while faceting on
the nested fields

{
"category" : "shirts"
"variation" : [
{

"color" : "blue",

"size" : 4

    },
    {

"color" : "green",

"size" : 6

   }
]

}

In the above doc for instance, I want to be able to do something like
below.

{

"query": {

"match_all": {}

},

"facets": {

  "size": {

               "terms": {
                         "field" : "size"
                },
                "nested": "obj1",
                "facet_filter" : {
                        "term" : {"category" : "shirts"}
                 }
         }

}

Is this possible ?

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

To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/be67102c-3f46-44cb-a5ed-c52399924451%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/et_V2JBTeA8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDD_Vx1Ltpo0g%2B_4XDOugQFuq3%3DK51h2ZaV2nFMzR039w%40mail.gmail.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CABKv5CL6RbL8mWYrn6Osd1Ftia1ExUnndGYeJOwOUY%3D43693KA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Karthick Duraisamy Soundararaj) #4

Thanks for the email Ivan. Sorry about my previous partial message.

I explored aggregations today. I tried the following query, but doesnt
work. Would be great if someone could help.

{

"query": {
"match_all": {}

},

"aggs": {

  "categories": {

                     "filter" : { "terms" : { "category" :  "shirts" }

},
"nested" : { "path" : "variation" },
"aggs" : {
"size" : {
"terms" : { "field" : "size" } }
}
}
}
}
}

Also, even filtering docs on nested field doesnt seem to work, for instance

  • the following query doesnt work

{

"query": {
"match_all": {}

},

"aggs": {

  "categories": {

                     "filter" : { "terms" : { "color" :  "blue" } },
                     "nested" : { "path" : "variation" },
                     "aggs" : {
                           "size" : {
                                   "terms" : { "field" : "size" } }
                            }
                      }
               }
       }

}

Thanks in advance

On Thu, Dec 5, 2013 at 5:10 PM, Karthick Duraisamy Soundararaj <
karthick.soundararaj@gmail.com> wrote:

I tried aggregations today. I am able to do this
{

"query": {

"match_all": {}

},

"aggs": {

  "size": {

               "filter" : { "range" : { "model" : { "gt" : 2013 } } },
         }

}

On Wed, Dec 4, 2013 at 7:52 PM, Ivan Brusic ivan@brusic.com wrote:

It is not possible to filter on the parent/root fields. I have not looked
if this functionality has been added with the new aggregation framework.

Cheers,

Ivan

On Wed, Dec 4, 2013 at 7:40 PM, dsk karthick.soundararaj@gmail.comwrote:

This documenthttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html#_all_nested_matching_root_documents shows
how to apply facet_filter on the fields in the nested documents. I want to
be able to apply facet_filter on the root/parent fields while faceting on
the nested fields

{
"category" : "shirts"
"variation" : [
{

"color" : "blue",

"size" : 4

    },
    {

"color" : "green",

"size" : 6

   }
]

}

In the above doc for instance, I want to be able to do something like
below.

{

"query": {

"match_all": {}

},

"facets": {

  "size": {

               "terms": {
                         "field" : "size"
                },
                "nested": "obj1",
                "facet_filter" : {
                        "term" : {"category" : "shirts"}
                 }
         }

}

Is this possible ?

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

To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/be67102c-3f46-44cb-a5ed-c52399924451%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/et_V2JBTeA8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDD_Vx1Ltpo0g%2B_4XDOugQFuq3%3DK51h2ZaV2nFMzR039w%40mail.gmail.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CABKv5CJpDBs_ZK4vzqDLwNEK_jtw%3Dp2tYTyi6Wc2KuuORggQ8w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5