Top Hits for nested type field is not working..

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Top Hits for nested type field is not working..

Anusha
Hi,
Am using fields with nested type, in the mappings I kept for column1 and column2 as nested type fields..

I am using the following query to get the top hits:

GET partsfilter/partsfilter_type/_search
{
    "size": 10,
     "query" : {
        "match" : { "description" : "abc" }
    },
    "aggs" : {
        "column1" : {
            "nested" : {
                "path" : "column1"
            },
            "aggs" : {
               "col1_agg":
               {
                   "terms":
                   {
                       "field":"column1.@key",
                       "size":0
                   },
                   "aggs":
                   {
                       "top":
                       {
                           "top_hits":
                           {
                               "size":1
                           }
                       }
                   }
               }
            }
        }
    }
}

This is throwing  SearchPhaseExecutionException[Failed to execute phase [query]  exception. when am removing top_hits aggs it is working fine.
how to write a top_hits query to work for the above case..

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/
---
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1a55439f-5099-4cdc-9c8e-20866fd4533e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Top Hits for nested type field is not working..

vineeth mohan-2
Hello , 

You cant write top_hits under nested aggregation.
While doing nested aggregation you need to deal with one abstract inner nested document at once and not the actual document.
Putting top_hists here does not make sense.

If you can state your problem more clearly , we might be able to help.

Thanks
           Vineeth Mohan,
           Elasticsearch consultant,


On Tue, Jun 23, 2015 at 1:30 PM, Muddadi Hemaanusha <[hidden email]> wrote:
Hi,
Am using fields with nested type, in the mappings I kept for column1 and column2 as nested type fields..

I am using the following query to get the top hits:

GET partsfilter/partsfilter_type/_search
{
    "size": 10,
     "query" : {
        "match" : { "description" : "abc" }
    },
    "aggs" : {
        "column1" : {
            "nested" : {
                "path" : "column1"
            },
            "aggs" : {
               "col1_agg":
               {
                   "terms":
                   {
                       "field":"column1.@key",
                       "size":0
                   },
                   "aggs":
                   {
                       "top":
                       {
                           "top_hits":
                           {
                               "size":1
                           }
                       }
                   }
               }
            }
        }
    }
}

This is throwing  SearchPhaseExecutionException[Failed to execute phase [query]  exception. when am removing top_hits aggs it is working fine.
how to write a top_hits query to work for the above case..

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/
---
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1a55439f-5099-4cdc-9c8e-20866fd4533e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/
---
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5ntqnWSS_sSPN-WLKXCDP-6SjZjsmNKOBdFNT6ZkDiOaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.