Multiple Statistical Facets in one search

Hello,

I'm trying to use multiple stats facets in one search like the code below,
however I'm getting an error message when I attempt to run this. Can
someone tell me what I'm doing wrong?

curl -XPOST '10.10.48.20:9200/kpi/misdiverts_by_lane/_search?pretty=true'
-d
'{
"query": {
"match_all": {}
},
"facets": {
"route_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "route_lane",
"value_field": "misdiverts",
"order": "term"
}
}
},
{
"actual_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "actual_lane",
"value_field": "misdiverts",
"order": "term"
}
}
}
}'

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

all seems to be right. I use may facets including terms_stats in one call.
what's the error?

On Friday, May 3, 2013 10:17:56 AM UTC-4, OffensivelyBad wrote:

Hello,

I'm trying to use multiple stats facets in one search like the code below,
however I'm getting an error message when I attempt to run this. Can
someone tell me what I'm doing wrong?

curl -XPOST '10.10.48.20:9200/kpi/misdiverts_by_lane/_search?pretty=true'
-d
'{
"query": {
"match_all": {}
},
"facets": {
"route_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "route_lane",
"value_field": "misdiverts",
"order": "term"
}
}
},
{
"actual_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "actual_lane",
"value_field": "misdiverts",
"order": "term"
}
}
}
}'

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

I get a verbose error, but it starts like this:

"error" : "SearchPhaseExecutionException[Failed to execute phase [query],
total failure; shardFailures

On Friday, May 3, 2013 1:22:32 PM UTC-4, AlexR wrote:

all seems to be right. I use may facets including terms_stats in one call.
what's the error?

On Friday, May 3, 2013 10:17:56 AM UTC-4, OffensivelyBad wrote:

Hello,

I'm trying to use multiple stats facets in one search like the code
below, however I'm getting an error message when I attempt to run this.
Can someone tell me what I'm doing wrong?

curl -XPOST '10.10.48.20:9200/kpi/misdiverts_by_lane/_search?pretty=true'
-d
'{
"query": {
"match_all": {}
},
"facets": {
"route_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "route_lane",
"value_field": "misdiverts",
"order": "term"
}
}
},
{
"actual_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "actual_lane",
"value_field": "misdiverts",
"order": "term"
}
}
}
}'

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

I should also mention that each stats facets works individually, but using
them together in the same search causes the error.

On Friday, May 3, 2013 4:58:17 PM UTC-4, OffensivelyBad wrote:

I get a verbose error, but it starts like this:

"error" : "SearchPhaseExecutionException[Failed to execute phase [query],
total failure; shardFailures

On Friday, May 3, 2013 1:22:32 PM UTC-4, AlexR wrote:

all seems to be right. I use may facets including terms_stats in one
call. what's the error?

On Friday, May 3, 2013 10:17:56 AM UTC-4, OffensivelyBad wrote:

Hello,

I'm trying to use multiple stats facets in one search like the code
below, however I'm getting an error message when I attempt to run this.
Can someone tell me what I'm doing wrong?

curl -XPOST '10.10.48.20:9200/kpi/misdiverts_by_lane/_search?pretty=true'
-d
'{
"query": {
"match_all": {}
},
"facets": {
"route_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "route_lane",
"value_field": "misdiverts",
"order": "term"
}
}
},
{
"actual_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "actual_lane",
"value_field": "misdiverts",
"order": "term"
}
}
}
}'

--
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 are not using correct format. all facets should be within facets:{}
object but you have them mixed up. try this (hopefully I did not mess up
json - hard to see indents in browser)

{
"query": {
"match_all": {}
},
"facets": {
"route_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "route_lane",
"value_field": "misdiverts",
"order": "term"
}
},
"actual_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "actual_lane",
"value_field": "misdiverts",
"order": "term"
}
}
}
}

On Friday, May 3, 2013 4:59:56 PM UTC-4, OffensivelyBad wrote:

I should also mention that each stats facets works individually, but using
them together in the same search causes the error.

On Friday, May 3, 2013 4:58:17 PM UTC-4, OffensivelyBad wrote:

I get a verbose error, but it starts like this:

"error" : "SearchPhaseExecutionException[Failed to execute phase [query],
total failure; shardFailures

On Friday, May 3, 2013 1:22:32 PM UTC-4, AlexR wrote:

all seems to be right. I use may facets including terms_stats in one
call. what's the error?

On Friday, May 3, 2013 10:17:56 AM UTC-4, OffensivelyBad wrote:

Hello,

I'm trying to use multiple stats facets in one search like the code
below, however I'm getting an error message when I attempt to run this.
Can someone tell me what I'm doing wrong?

curl -XPOST '
10.10.48.20:9200/kpi/misdiverts_by_lane/_search?pretty=true' -d
'{
"query": {
"match_all": {}
},
"facets": {
"route_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "route_lane",
"value_field": "misdiverts",
"order": "term"
}
}
},
{
"actual_lane_misdiverts_stats": {
"terms_stats": {
"key_field": "actual_lane",
"value_field": "misdiverts",
"order": "term"
}
}
}
}'

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