Skip to content

Nest driver can't create include: "" element in the aggregations #2682

@wolczas

Description

@wolczas

Elasticsearch version: 5.2.2

OS version: Win 10

Description of the problem including expected versus actual behavior:
include section in the aggregation is unable to create a simple string inside of terms.

I want to create

"catpaths": {
          "terms": {
            "field": "categories.categoryPath",
           "include": "(/[^/]+){2}"
          },

Using Nest statements include value gets wrapped in [] and pattern elements:

  • TermsAggregationDescriptor<T> Include(string includePattern, string regexFlags = null);
    Nest:
          .Include(@"(/[^/]+){2}*","")
    DSL:
           "include":{"pattern":"(/[^/]+){2}"}}

  • TermsAggregationDescriptor<T> Include(IEnumerable<string> values)
    Nest:
          var sequence = Enumerable.Repeat("(/[^/]+){2}", 1);
          .Include(sequence)
    DSL:
          "include": ["(/[^/]+){2}"]

I need a Nest TermsAggregationDescriptor include statement that will generate string DSL:
             "include": "(/[^/]+){2}"

Extra pattern element prevents parser to continue with evaluating nested aggs.
Array of include [] uses literal strings and does not evaluate elements regex expression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions