Skip to content

TermsAggregationDescriptor .Include function bug #592

@deviantus

Description

@deviantus

Hi, when i trying to use .Include function of terms aggregation below exception occurs.

[ArgumentException: An item with the same key has already been added.]

I think the cause of this error, function tries to add dictionay to both includepattern and regexflags with same key which is "pattern"

        [JsonProperty("include")]
        internal IDictionary<string, string> _Include { get; set; }

        public TermsAggregationDescriptor<T> Include(string includePattern, string regexFlags = null)
        {
            this._Include = new Dictionary<string, string> { {"pattern", includePattern}};
            if (!regexFlags.IsNullOrEmpty())
                this._Include.Add("pattern", regexFlags);
            return this;
        }

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