Creating facets from nested data


(Sander Toonen) #1

Hi,

I'm playing with ES for a few days now but I'm stuck where it comes to
facetted search.
I have documents that are formatted in a specific way. Since they are
pulled in via the Mongo River plugin I have not that much control over the
format.
They look like this:

{
"_id": { "$oid" : "522494037c92286f44acd7f8" },
"description": "....",
"created": "2013-08-20 11:26:13",
"modified": "2013-08-20 11:26:13",
"some_nested_data": [
...,
...
],
"features": [
{
"name": "color",
"label": "Color",
"value": "Blue",
"type": "string",
"modified": "2013-08-20 11:31:01",
...
},
{
"name": "length_mm",
"label": "Length (in mm)",
"value": "1200",
"type": "int",
"modified": "2013-08-20 11:31:01",
...
},
...
]
}

Is there a way so that I can create facets from the nested data in the
'features' array?
I'd like to be able to filter on color:Blue for example.

Thanks!

Sander

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


(Radu Gheorghe) #2

Hello,

If your features are defined as nested
typehttp://www.elasticsearch.org/guide/reference/mapping/nested-type/in
your mapping, you have to specify the path when you do the facet. To
see
an example, look for "nested" in here:
http://www.elasticsearch.org/guide/reference/api/search/facets/

If it's not a nested type, then you should be able to refer to the field
you need with something like features.color

Best regards,
Radu

http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

On Mon, Sep 2, 2013 at 8:02 PM, Sander Toonen s.toonen@gmail.com wrote:

Hi,

I'm playing with ES for a few days now but I'm stuck where it comes to
facetted search.
I have documents that are formatted in a specific way. Since they are
pulled in via the Mongo River plugin I have not that much control over the
format.
They look like this:

{
"_id": { "$oid" : "522494037c92286f44acd7f8" },
"description": "....",
"created": "2013-08-20 11:26:13",
"modified": "2013-08-20 11:26:13",
"some_nested_data": [
...,
...
],
"features": [
{
"name": "color",
"label": "Color",
"value": "Blue",
"type": "string",
"modified": "2013-08-20 11:31:01",
...
},
{
"name": "length_mm",
"label": "Length (in mm)",
"value": "1200",
"type": "int",
"modified": "2013-08-20 11:31:01",
...
},
...
]
}

Is there a way so that I can create facets from the nested data in the
'features' array?
I'd like to be able to filter on color:Blue for example.

Thanks!

Sander

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


(Sander Toonen) #3

I don't believe that that will work with my structure will it?

Doesn't the nested type require you to have {: }?
I have a structure where the format is {name: , value: }.

On Tuesday, 3 September 2013 12:22:53 UTC+2, Radu Gheorghe wrote:

Hello,

If your features are defined as nested typehttp://www.elasticsearch.org/guide/reference/mapping/nested-type/in your mapping, you have to specify the path when you do the facet. To see
an example, look for "nested" in here:
http://www.elasticsearch.org/guide/reference/api/search/facets/

If it's not a nested type, then you should be able to refer to the field
you need with something like features.color

Best regards,
Radu

http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

On Mon, Sep 2, 2013 at 8:02 PM, Sander Toonen <s.to...@gmail.com<javascript:>

wrote:

Hi,

I'm playing with ES for a few days now but I'm stuck where it comes to
facetted search.
I have documents that are formatted in a specific way. Since they are
pulled in via the Mongo River plugin I have not that much control over the
format.
They look like this:

{
"_id": { "$oid" : "522494037c92286f44acd7f8" },
"description": "....",
"created": "2013-08-20 11:26:13",
"modified": "2013-08-20 11:26:13",
"some_nested_data": [
...,
...
],
"features": [
{
"name": "color",
"label": "Color",
"value": "Blue",
"type": "string",
"modified": "2013-08-20 11:31:01",
...
},
{
"name": "length_mm",
"label": "Length (in mm)",
"value": "1200",
"type": "int",
"modified": "2013-08-20 11:31:01",
...
},
...
]
}

Is there a way so that I can create facets from the nested data in the
'features' array?
I'd like to be able to filter on color:Blue for example.

Thanks!

Sander

--
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 elasticsearc...@googlegroups.com <javascript:>.
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.


(system) #4