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

[Backport 7.6] Add categorization analyzer to defaults on ml info response #4414

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Nest
{
Expand Down Expand Up @@ -33,6 +34,18 @@ public class AnomalyDetectors

[DataMember(Name = "model_snapshot_retention_days")]
public int ModelSnapshotRetentionDays { get; internal set; }

[DataMember(Name = "categorization_analyzer")]
public CategorizationAnalyzer CategorizationAnalyzer { get; internal set; }
}

public class CategorizationAnalyzer
{
[DataMember(Name = "tokenizer")]
public string Tokenizer { get; internal set; }

[DataMember(Name = "filter")]
public IReadOnlyCollection<ITokenFilter> Filter { get; internal set; }
}

public class Datafeeds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,20 @@ protected override void ExpectResponse(MachineLearningInfoResponse response)
{
response.ShouldBeValid();

response.Defaults.AnomalyDetectors.ModelMemoryLimit.Should().Be("1gb");
response.Defaults.AnomalyDetectors.CategorizationExamplesLimit.Should().Be(4);
response.Defaults.AnomalyDetectors.ModelSnapshotRetentionDays.Should().Be(1);
var anomalyDetectors = response.Defaults.AnomalyDetectors;
anomalyDetectors.ModelMemoryLimit.Should().Be("1gb");
anomalyDetectors.CategorizationExamplesLimit.Should().Be(4);
anomalyDetectors.ModelSnapshotRetentionDays.Should().Be(1);

response.Defaults.Datafeeds.ScrollSize.Should().Be(1000);

if (Cluster.ClusterConfiguration.Version >= "7.6.0")
{
var analyzer = anomalyDetectors.CategorizationAnalyzer;
analyzer.Should().NotBeNull();
analyzer.Tokenizer.Should().Be("ml_classic");
analyzer.Filter.Should().NotBeNullOrEmpty();
}
}
}
}