It sounds like you are using nested documents. I guess it comes from here.

--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


Le 6 sept. 2014 à 07:49, Ron Sher <ron.s...@gmail.com> a écrit :

Hi,

I've started to use aggregations and it works very fast and cool. But it seems 
to get the wrong doc_count as opposed to the total hits.

For example - here's a typical search I use (I got for it total hits - 111 and 
doc_count 1348) :
{
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "bool": {
          "must": [
            {
              "term": {
                "service_id": "880"
              }
            },
            {
              "bool": {
                "must": {
                  "term": {
                    "status_group": "paying"
                  }
                }
              }
            }
          ]
        }
      }
    }
  },
  "aggregations": {
    "atts": {
      "nested": {
        "path": "string_attributes"
      },
      "aggregations": {
        "filter_atts": {
          "filter": {
            "term": {
              "string_attributes.key": "Sales Manager"
            }
          },
          "aggregations": {
            "values": {
              "terms": {
                "field": "string_attributes.value",
                "size": 0,
                "order": {
                  "_term": "asc"
                }
              },
              "aggregations": {
                "reversed": {
                  "reverse_nested": {},
                  "aggregations": {
                    "health": {
                      "terms": {
                        "field": "health"
                      }
                    },
                    "missing_health": {
                      "missing": {
                        "field": "health"
                      }
                    },
                    "avg_contract_value": {
                      "avg": {
                        "field": "contract_value"
                      }
                    },
                    "sum_contract_value": {
                      "sum": {
                        "field": "contract_value"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "avg_contract_value": {
      "avg": {
        "field": "contract_value"
      }
    },
    "sum_contract_value": {
      "sum": {
        "field": "contract_value"
      }
    }
  }
}
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAKHuyJpNLN8Zw7cQjFjTvQTpfrPLDkrhzBmEyFXApWYti1r1tQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/3A592117-5A62-4B5E-A1C3-E954C275E1FC%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to