首页 > 解决方案 > 带有聚合的 Elasticsearch 转换未显示所有结果?也尝试过 size 属性

问题描述

嗨,我正在尝试在其他索引中找到匹配的文档...我在弹性云门户中找到了以下示例...我得到了预期的结果,但问题是结果未显示超过 100它工作的地方

POST /_transform/_preview?pretty
{
  "id": "index_compare",
  "source": {
    "index": [
      "pvrmreporesult"
    ]
  },
  "dest": {
    "index": [
      "new_literature"
      ],
    "query": { 
    "bool": { 
      "filter": [ 
        { "term":  { "compunitid.keyword": "XYZ"  }},
        { "range": { "indexeddate": {  
        "lte": "2020-11-29T00:00:00" }}} 
      ]
    }
   }
  },
  "pivot": {
    "group_by": {
      "unique-id": {
        "terms": {
          "field": "title.keyword"
        }
      }
    },
    "aggregations": {
      "compare": {
        "scripted_metric": {
          "map_script": "state.doc = new HashMap(params['_source'])",
          "combine_script": "return state",
          "reduce_script": """ 
            if (states.size() != 2) {
              return "count_mismatch"
            }
              return "match"
            """
        }
      }
    }
  },
   "settings": {
    "max_page_search_size": 5000
  }
}

试图根据字段标题查找 pvrmreporesult 和 new_literature 中常见的文档..

标签: elasticsearchkibanaelasticsearch-aggregation

解决方案


推荐阅读