Skip to content

Commit

Permalink
Add categorization analyzer to defaults on ml info response
Browse files Browse the repository at this point in the history
  • Loading branch information
russcam committed Feb 21, 2020
1 parent 916214e commit b37f251
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
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();
}
}
}
}

0 comments on commit b37f251

Please sign in to comment.