Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend allowed characters in aggregation name #6702

Closed
colings86 opened this issue Jul 3, 2014 · 7 comments
Closed

Extend allowed characters in aggregation name #6702

colings86 opened this issue Jul 3, 2014 · 7 comments

Comments

@colings86
Copy link
Contributor

Currently aggregations names must match the pattern [a-zA-Z0-9\\-_]+. This is pretty restrictive and prevents, for example, a common naming pattern of using dots in names. We should extend this pattern to be less restrictive.

Currently an aggregation can refer to values within child aggregations using two methods:

  1. agg_name['val_name']
  2. agg_name.val_name

Allowing dots in the aggregation name will mean that we drop support for option 2 in favour of 1.

@felixbarny
Copy link
Member

Not understaning the reason why only alpa-numeric chars are allowed, wouldn't it be possible to allow any char by internally working with hexadecimal encoded strings? I would really wish, that arbitrary chars would still be allowed. My current workaround is to do the hex encoding manually. My aggregation names are computed dynamically and are displayed on the frontend, so avoiding non-alpha-numerics is not an option for me.

("cross-posted" from #5253)

@clintongormley
Copy link
Contributor

@colings86 What about allowing escaping of dots? eg "foo.bar.baz" (as JSON "foo\.bar.baz")?

@colings86
Copy link
Contributor Author

relates to #6736

colings86 added a commit that referenced this issue Jul 8, 2014
Aggregation name are now able to use any character except '[', ']', and '>". Dot syntax may still be used to reference values (e.g. in the order field) but may only defence the value directly beneath the last aggregation in the list. more complex structures will need to be accessed using the aggname[value] syntax

Closes #6702
@felixbarny
Copy link
Member

Good job!
Will it be included in 1.2.2? Is there some place that shows when the next release is due?

@colings86
Copy link
Contributor Author

This will be available from version 1.3 as 1.2.2 is intended for bug fixes.

We try to release every couple of months, but it depends on the features we are working on. We don't announce release dates ahead of time.

@clintongormley clintongormley changed the title Aggregations: Extend allowed characters in aggregation name Extend allowed characters in aggregation name Jun 7, 2015
@gulcabuk
Copy link

Hi,

I'm trying to use bucket selection with over an aggregation whose name contains numerical characters. Same error has been occurred for me. I realized that aggregations with numeric characters has been solved but I think there is still an error for bucket selection.

Is there a way to solve this?

Error:

{
  "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
}

My query:

{
  "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"
          }
        }
      }
    }
  }
}

@rjernst
Copy link
Member

rjernst commented Aug 14, 2017

@gulcabuk Please ask questions on our forum. This issue was closed 3 years ago, and we use github for feature requests and confirmed bug reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants