Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can ElasticSearch return elements of an array of a single document?

With a document like:

{
    "obj1" : [
        {
            "name" : "blue",
            "count" : 4
        },
        {
            "name" : "green",
            "count" : 6
        }
    ]
}

Is it possible to query for a obj1.name = "blue" to obtain the matching element of the array, not the document?:

{
    "name" : "blue",
    "count" : 4
}

Thanks in advance!

like image 444
John Fadria Avatar asked Nov 02 '22 13:11

John Fadria


1 Answers

I think it is not possible now. But there is open issue for returning nested inner objects.

like image 78
vhyza Avatar answered Nov 08 '22 07:11

vhyza