简体   繁体   English

弹性搜索统计方面-汇总

[英]Elastic Search Statistical Facets - Aggregation

So I have an index containing a 82 documents like the following (sample data to familiarise me with the api). 因此,我有一个包含82个文档的索引,如下所示(示例数据使我熟悉api)。

{"_index":"foo","_type":"bar","_id":"3675293","_score":1.0, "_source" : {
  "companyId": 3675293,
  "companyName": "ABC",
  "companyOwner": {
    "ownerFirstName": "Billy",
    "ownerLastName": "Jean"
  },
  "created": "2013-05-22T13:45:49",
  "accounts": [
    {
      "year": 2013,
      "amount": 1.0,
      "currency": "GBP"
    },
    {
      "year": 2012,
      "amount": 1.0,
      "currency": "GBP"
    }
  ]
}}

The problem I have is that I'm trying to total all of the amounts. 我的问题是,我正在尝试总计所有金额。 When I use a Statistical Facet via the NEST .Net client I get an answer I wouldn't expect. 当我通过NEST .Net客户端使用统计构面时,会得到我不期望的答案。

82 documents, each with a collection containing 2 amount of £1 in my mind aggregates to a total of 2 X 82 = 164. However, the facet returns a total of 82. When I change one of the amounts in each of the two documents to be 2 instead of 1, I get the correct result. 82个文档,每个文档中包含2个£1的集合在我的脑海中总计为2 X 82 =164。但是,构面总共返回82。当我更改两个文档中的每个文档中的一个金额时为2而不是1,我得到正确的结果。

Does Elastic Search only aggregate unique numerical values per document? Elastic Search是否仅汇总每个文档的唯一数值? Can this be overriden? 可以覆盖吗?

Thanks Tim 谢谢蒂姆

I posted the same question on the google group for Elastic Search. 我在Google网上论坛上针对弹性搜索发布了相同的问题。 Question and response here. 问题和回应在这里。

https://groups.google.com/forum/#!topic/elasticsearch/wNjrnAC_KOY https://groups.google.com/forum/#!topic/elasticsearch/wNjrnAC_KOY

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM