Skip to content

Add x-pack features to XPackUsage and XPackInfo responses #4065

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

Merged
merged 2 commits into from
Sep 4, 2019
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
9 changes: 9 additions & 0 deletions src/Nest/XPack/Info/XPackInfo/XPackInfoResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public class XPackFeatures
[DataMember(Name = "ccr")]
public XPackFeature Ccr { get; internal set; }

[DataMember(Name = "data_frame")]
public XPackFeature DataFrame { get; internal set; }

[DataMember(Name = "flattened")]
public XPackFeature Flattened { get; internal set; }

[DataMember(Name = "graph")]
public XPackFeature Graph { get; internal set; }

Expand All @@ -71,6 +77,9 @@ public class XPackFeatures
[DataMember(Name = "sql")]
public XPackFeature Sql { get; internal set; }

[DataMember(Name = "vectors")]
public XPackFeature Vectors { get; internal set; }

[DataMember(Name = "watcher")]
public XPackFeature Watcher { get; internal set; }
}
Expand Down
32 changes: 32 additions & 0 deletions src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Elasticsearch.Net;

Expand Down Expand Up @@ -44,6 +45,15 @@ public class XPackUsageResponse : ResponseBase
[DataMember(Name = "rollup")]
public XPackUsage Rollup { get; internal set; }

[DataMember(Name = "data_frame")]
public XPackUsage DataFrame { get; internal set; }

[DataMember(Name = "flattened")]
public XPackUsage Flattened { get; internal set; }

[DataMember(Name = "ilm")]
public IlmUsage IndexLifecycleManagement { get; internal set; }

[DataMember(Name = "ccr")]
public CcrUsage Ccr { get; internal set; }

Expand All @@ -65,6 +75,9 @@ public class XPackUsageResponse : ResponseBase
[DataMember(Name = "security")]
public SecurityUsage Security { get; internal set; }

[DataMember(Name = "vectors")]
public XPackUsage Vectors { get; internal set; }

[DataMember(Name = "voting_only")]
public XPackUsage VotingOnly { get; internal set; }
}
Expand Down Expand Up @@ -312,4 +325,23 @@ public class ForecastStatistics
public long Total { get; internal set; }
}
}

public class IlmUsage
{
[DataMember(Name = "policy_count")]
public int PolicyCount { get; internal set; }

[DataMember(Name = "policy_stats")]
public IReadOnlyCollection<IlmPolicyStatistics> PolicyStatistics { get; internal set; } =
EmptyReadOnly<IlmPolicyStatistics>.Collection;

public class IlmPolicyStatistics
{
[DataMember(Name = "phases")]
public IPhases Phases { get; internal set; }

[DataMember(Name = "indices_managed")]
public int IndicesManaged { get; internal set; }
}
}
}
15 changes: 14 additions & 1 deletion src/Tests/Tests/XPack/Info/XPackInfoApiTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Net;
using System.Threading.Tasks;
using Elastic.Xunit.XunitPlumbing;
using FluentAssertions;
Expand Down Expand Up @@ -61,6 +62,13 @@ [I] public async Task XPackInfoResponse() => await Assert<XPackInfoResponse>(XPa
r.Features.Sql.Should().NotBeNull();
r.Features.Watcher.Should().NotBeNull();
r.License.Should().NotBeNull();

if (TestConfiguration.Instance.InRange(">=7.3.0"))
{
r.Features.Flattened.Should().NotBeNull();
r.Features.DataFrame.Should().NotBeNull();
r.Features.Vectors.Should().NotBeNull();
}
});

[I] public async Task XPackUsageResponse() => await Assert<XPackUsageResponse>(XPackUsageStep, (v, r) =>
Expand Down Expand Up @@ -90,7 +98,12 @@ [I] public async Task XPackUsageResponse() => await Assert<XPackUsageResponse>(X
r.Alerting.Watch.Should().NotBeNull();

if (TestConfiguration.Instance.InRange(">=7.3.0"))
r.VotingOnly.Should().NotBeNull();
{
r.Flattened.Should().NotBeNull();
r.DataFrame.Should().NotBeNull();
r.Vectors.Should().NotBeNull();
r.VotingOnly.Should().NotBeNull();
}
});
}
}