Facets with Nested and string in same request

Hi elasticers, how are u? :slight_smile:

Can I request two facets (a string and a field of a nested field) in the
same request?

example of my facet request:

{
"query": {
"match": {
"product_name": {
"query": "red t-shirt",
"operator": "and",
"analyzer": "default",
"fuzziness": null,
"lenient": true,
"max_expansions": 100,
"minimum_should_match": 2,
"prefix_length": 2,
"type": null
}
}
},
"facets": {
"Mark": {
"terms": {
"fields": [
"mark_name"
],
"order": "count",
"all_terms": false,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"script": null,
"script_field": "_source.mark_name",
"params": null,
"lang": null
},
"facet_filter": null
},
"Products": {
"terms": {
"fields": [
"product_name"
],
"order": "count",
"all_terms": false,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"script": null,
"script_field": "_source.product_name",
"params": null,
"lang": null
},
"facet_filter": null
},
"Colors": {
"terms_stats": {
"fields": null,
"order": "total",
"all_TermsStats": null,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"key_field": "color",
"value_field": "count",
"key_script": null,
"value_script": null,
"params": null,
"lang": null
},
"facet_filter": null
}
}
}

to me, it's return a Java Exception:
Caused by: org.elasticsearch.ElasticSearchIllegalArgumentException: failed
to find mappings for [count]

thanks!!

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

Hi Anderson

Do you mean "nested" or an inner object? They are different. A nested
object has type nested, as opposed to type object.

If you DO mean "nested", then you have to specify that you want a nested
facet Elasticsearch Platform — Find real-time answers at scale | Elastic

Not sure how ES will play with all of those null values :slight_smile:

clint

On 24 May 2013 04:18, Anderson Bento deca.rox@gmail.com wrote:

Hi elasticers, how are u? :slight_smile:

Can I request two facets (a string and a field of a nested field) in the
same request?

example of my facet request:

{
"query": {
"match": {
"product_name": {
"query": "red t-shirt",
"operator": "and",
"analyzer": "default",
"fuzziness": null,
"lenient": true,
"max_expansions": 100,
"minimum_should_match": 2,
"prefix_length": 2,
"type": null
}
}
},
"facets": {
"Mark": {
"terms": {
"fields": [
"mark_name"
],
"order": "count",
"all_terms": false,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"script": null,
"script_field": "_source.mark_name",
"params": null,
"lang": null
},
"facet_filter": null
},
"Products": {
"terms": {
"fields": [
"product_name"
],
"order": "count",
"all_terms": false,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"script": null,
"script_field": "_source.product_name",
"params": null,
"lang": null
},
"facet_filter": null
},
"Colors": {
"terms_stats": {
"fields": null,
"order": "total",
"all_TermsStats": null,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"key_field": "color",
"value_field": "count",
"key_script": null,
"value_script": null,
"params": null,
"lang": null
},
"facet_filter": null
}
}
}

to me, it's return a Java Exception:
Caused by: org.elasticsearch.ElasticSearchIllegalArgumentException:
failed to find mappings for [count]

thanks!!

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

yes, I have a nested type.

when I follow the example of api, I get a Exception of java (failed to
finding maps for [count]

I forget to post the url when i send the jSON:
curl -XGET http://localhost:9200/products/_search\?pretty\=true

Em sexta-feira, 24 de maio de 2013 07h34min45s UTC-3, Clinton Gormley
escreveu:

Hi Anderson

Do you mean "nested" or an inner object? They are different. A nested
object has type nested, as opposed to type object.

If you DO mean "nested", then you have to specify that you want a nested
facet Elasticsearch Platform — Find real-time answers at scale | Elastic

Not sure how ES will play with all of those null values :slight_smile:

clint

On 24 May 2013 04:18, Anderson Bento <deca...@gmail.com <javascript:>>wrote:

Hi elasticers, how are u? :slight_smile:

Can I request two facets (a string and a field of a nested field) in the
same request?

example of my facet request:

{
"query": {
"match": {
"product_name": {
"query": "red t-shirt",
"operator": "and",
"analyzer": "default",
"fuzziness": null,
"lenient": true,
"max_expansions": 100,
"minimum_should_match": 2,
"prefix_length": 2,
"type": null
}
}
},
"facets": {
"Mark": {
"terms": {
"fields": [
"mark_name"
],
"order": "count",
"all_terms": false,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"script": null,
"script_field": "_source.mark_name",
"params": null,
"lang": null
},
"facet_filter": null
},
"Products": {
"terms": {
"fields": [
"product_name"
],
"order": "count",
"all_terms": false,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"script": null,
"script_field": "_source.product_name",
"params": null,
"lang": null
},
"facet_filter": null
},
"Colors": {
"terms_stats": {
"fields": null,
"order": "total",
"all_TermsStats": null,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"key_field": "color",
"value_field": "count",
"key_script": null,
"value_script": null,
"params": null,
"lang": null
},
"facet_filter": null
}
}
}

to me, it's return a Java Exception:
Caused by: org.elasticsearch.ElasticSearchIllegalArgumentException:
failed to find mappings for [count]

thanks!!

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

This has nothing to do with the facets. Your URL is messed up:

/products/_search%5C?pretty%5C=true

You're escaping the ?

But you also have errors in your facet, if you're using nested. You're
not specifying nested facets

clint

On 24 May 2013 16:03, Anderson Bento deca.rox@gmail.com wrote:

yes, I have a nested type.

when I follow the example of api, I get a Exception of java (failed to
finding maps for [count]

I forget to post the url when i send the jSON:
curl -XGET http://localhost:9200/products/_search\?pretty\=true

Em sexta-feira, 24 de maio de 2013 07h34min45s UTC-3, Clinton Gormley
escreveu:

Hi Anderson

Do you mean "nested" or an inner object? They are different. A nested
object has type nested, as opposed to type object.

If you DO mean "nested", then you have to specify that you want a nested
facet http://www.**Elasticsearch Platform — Find real-time answers at scale | Elastichttp://www.elasticsearch.org/guide/reference/api/search/facets/

Not sure how ES will play with all of those null values :slight_smile:

clint

On 24 May 2013 04:18, Anderson Bento deca...@gmail.com wrote:

Hi elasticers, how are u? :slight_smile:

Can I request two facets (a string and a field of a nested field) in the
same request?

example of my facet request:

{
"query": {
"match": {
"product_name": {
"query": "red t-shirt",
"operator": "and",
"analyzer": "default",
"fuzziness": null,
"lenient": true,
"max_expansions": 100,
"minimum_should_match": 2,
"prefix_length": 2,
"type": null
}
}
},
"facets": {
"Mark": {
"terms": {
"fields": [
"mark_name"
],
"order": "count",
"all_terms": false,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"script": null,
"script_field": "_source.mark_name",
"params": null,
"lang": null
},
"facet_filter": null
},
"Products": {
"terms": {
"fields": [
"product_name"
],
"order": "count",
"all_terms": false,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"script": null,
"script_field": "_source.product_name",
"params": null,
"lang": null
},
"facet_filter": null
},
"Colors": {
"terms_stats": {
"fields": null,
"order": "total",
"all_TermsStats": null,
"size": null,
"exclude": null,
"regex": null,
"regex_flags": null,
"key_field": "color",
"value_field": "count",
"key_script": null,
"value_script": null,
"params": null,
"lang": null
},
"facet_filter": null
}
}
}

to me, it's return a Java Exception:
Caused by: org.elasticsearch.ElasticSearchIllegalArgumentException:
failed to find mappings for [count]

thanks!!

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

For more options, visit https://groups.google.com/**groups/opt_outhttps://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.

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