Facets based on object properties instead of string array


(Yannick Smits-2) #1

Ok so we can do a facets search based on multiple string terms attached to a
document using an array as explained here
http://www.elasticsearch.org/guide/reference/api/search/facets/index.html
with the tags example.

Now can we achieve the same if our field is not a string array but a more
complex object like:

           "categories":{

              "type":"object",

              "properties":{

                 "name":{

                    "type" : "string",

                    "index":"not_analyzed"

                 },

                 "content" : { 

                    "type" : "string" 

                 }

              }

           }

In this mapping example I would like to do a facet for the categories.name
when there would possibly be multiple categories per document in this
structure.

Thanks,

Yannick


(Shay Banon) #2

Yes.
On Wednesday, May 25, 2011 at 3:18 PM, Yannick Smits wrote:

Ok so we can do a facets search based on multiple string terms attached to a document using an array as explained here with the tags example.
Now can we achieve the same if our field is not a string array but a more complex object like:
"categories":{
"type":"object",
"properties":{
"name":{
"type" : "string",
"index":"not_analyzed"
},
"content" : {
"type" : "string"
}
}
}
In this mapping example I would like to do a facet for the categories.name when there would possibly be multiple categories per document in this structure.

Thanks,
Yannick


(system) #3