聚合名称无效。聚合名称必须是字母数字,并且只能包含“_”和“ - ”“

时间:2017-08-14 08:37:31

标签: elasticsearch aggregation numeric alphanumeric

我正在尝试将桶选择与名称中包含数字字符的聚合一起使用。 无效的聚合名称[secondagg_sum_ [filters_equals_100]]。聚合名称必须是字母数字,并且只能包含'_'和' - '“错误。我意识到数字字符的聚合已经解决,但我认为存储桶仍然存在错误选择。我在弹性搜索论坛上提出了问题,但是没有人回复。有没有人如何解决这个问题?

PS:我正在动态生成聚合名称,因此我需要使用数字字符。

错误:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "parsing_exception",
        "reason" : "Invalid aggregation name [secondagg_sum_[filters_equals_100]]. Aggregation names must be alpha-numeric and can only contain '_' and '-'",
        "line" : 1,
        "col" : 318
      }
    ],
    "type" : "parsing_exception",
    "reason" : "Invalid aggregation name [secondagg_sum_[filters_equals_100]]. Aggregation names must be alpha-numeric and can only contain '_' and '-'",
    "line" : 1,
    "col" : 318
  },
  "status" : 400
}

我的查询:

{
  "size": 0,
  "query": {
    "bool": {
      "disable_coord": false,
      "adjust_pure_negative": true,
      "boost": 1.0
    }
  },
  "aggregations": {
    "first_agg": {
      "terms": {
        "field": "firstproperty",
        "size": 2147483647,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": {
          "_term": "asc"
        }
      },
      "aggregations": {
        "secondagg_sum_[filters_equals_100]": {
          "sum": {
            "field": "secondproperty"
          }
        },
        "agg_values": {
          "bucket_selector": {
            "buckets_path": {
              "total": "secondagg_sum_[filters_equals_100]"
            },
            "script": {
              "inline": "params.total > 100",
              "lang": "painless"
            },
            "gap_policy": "skip"
          }
        }
      }
    }
  }
}

0 个答案:

没有答案