ElasticSearch 2.1" aggs"不是有效参数

时间:2016-05-03 07:43:51

标签: php rest elasticsearch parameters

我做了以下休息请求并且正在工作

{
  "aggs": {
    "gender": {
      "terms": {
        "field": "gender"
      }
    }
  },
  "size": 0
}

但是当我在PHP中使用这样的数组:

['aggs' => [
        'gender'  => [
            'terms' => [
                'field' => 'gender'
            ],
        ],
    ],
];

我收到以下错误:

{
code: 500,
message: ""aggs" is not a valid parameter. Allowed parameters are: "analyzer", "analyze_wildcard", "default_operator", "df", "explain", "fields", "from", "ignore_unavailable", "allow_no_indices", "expand_wildcards", "indices_boost", "lenient", "lowercase_expanded_terms", "preference", "q", "query_cache", "request_cache", "routing", "scroll", "search_type", "size", "sort", "source", "_source", "_source_exclude", "_source_include", "stats", "suggest_field", "suggest_mode", "suggest_size", "suggest_text", "timeout", "version", "fielddata_fields", "filter_path", "client", "custom", "filter_path"",
errors: [ ]
}

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,这是代码PHP中的一个问题

我们正在使用Framework Majora,我们只将ElasticSearch中的查询返回给响应。

所以我会修复聚合以在响应中返回aggs。

由于