Elasticsearch-net: SignificantTerms: Exclude should take List as parameter

Created on 21 Mar 2017  路  4Comments  路  Source: elastic/elasticsearch-net

NEST/Elasticsearch.Net version: v5.2.0

Elasticsearch version: v5.2.2

Description of the problem including expected versus actual behavior:
The SignificantTerms aggregation should be able to take a List<string> in the exclude/include parameters to produce:

"significant_terms": {
        "field": "activityNames.keyword",
        "exclude": 
           [
              "Cardio Pulse",
              "Strength & Core",
              "Power",
              "Dance Step",
              "Hatha Yoga"
            ]        
      }

Now the exclude/include parameters only accepts FluentDictionary<string,string> which produces:

"significant_terms": {
        "field": "activityNames.keyword",
        "exclude": {
          "Cardio Pulse": "Cardio Pulse",
          "Strength & Core": "Strength & Core",
          "Power": "Power",
          "Dance Step": "Dance Step",
          "Hatha Yoga": "Hatha Yoga"
        }
      }

This throws:

    {
        "type": "parsing_exception",
        "reason": "[significant_terms] failed to parse field [exclude]",
        "line": 10,
        "col": 27
      }

Having FluentDictionary<string,string> makes sens in include parameter for the Terms aggregation when running the partition feature:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_filtering_values_with_partitions

Steps to reproduce:

  1. Run query with SignificantTerms aggregation with a dictionary in exclude parameter.
bug v5.3.0

Most helpful comment

@jhellemann, @wolczas thanks for reporting; this is a bug 馃悰

Looking at a fix for the next release.

All 4 comments

I'm having a similar issue with include in the AggregationContainerDescriptor.

Include accepts
IEnumerable<string> values
string includePattern, string regexFlags
long partion, long numberOfPartitions

I want include to produce DSL:
"include": "(/[^/]+){2}"

All I can produce is:
"include":{"pattern":"(/[^/]+){2}"}}
"include": ["(/[^/]+){2}"]

https://github.com/elastic/elasticsearch-net/issues/2682

Yes, you are correct. I'm having the same issues when testing Terms aggregation with include parameter. I'm also getting invalid DSL when using include parameter in aggregations and a query.

@jhellemann, @wolczas thanks for reporting; this is a bug 馃悰

Looking at a fix for the next release.

Closed via #2696

Was this page helpful?
0 / 5 - 0 ratings

Related issues

russcam picture russcam  路  3Comments

maxsel picture maxsel  路  5Comments

Cnordbo picture Cnordbo  路  4Comments

mausch picture mausch  路  4Comments

codebrain picture codebrain  路  3Comments