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

Added unmapped endpoints #2894

Merged

Conversation

codebrain
Copy link
Contributor

No description provided.

@codebrain codebrain requested a review from russcam November 10, 2017 02:36
@codebrain codebrain mentioned this pull request Nov 10, 2017
27 tasks
Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, small (some pedantic!) changes

{
public class NodeUsageMetadata
{
[JsonProperty(PropertyName = "total")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pedant alert! Can these just be [JsonProperty("total")], etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


namespace Nest
{
public class NodeUsageMetadata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the type should be NodesUsageMetadata to reflect the method name that it contains meta data on many nodes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think the name should be NodesMetaData, which mirrors the existing ShardsMetaData

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think MetaData suffix is a mistake in my part. We have both Metadata and MetaData suffixes in the code base and I've been leaning towards the first since that mimmics elasticsearch's snake casing of metadata. Maybe in 6.0 we do a sweep to standardize, worth the breaking change?

public IReadOnlyDictionary<string, NodeUsageInformation> Nodes { get; internal set; } = EmptyReadOnly<string, NodeUsageInformation>.Dictionary;

[JsonProperty(PropertyName = "_nodes")]
public NodeUsageMetadata NodeMetadata { get; internal set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe property name should be NodesMetaData, to mirror the type name (and since we can't use Nodes...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at usage of ShardsMetaData, the property has tended to be called ShardsHit - maybe this should be NodesHit here?

public partial interface IElasticClient
{
/// <summary>
/// Retrieving which patterns which the grok processor is packaged with, useful as different versions are bundled with different processors.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pedant alert!: Retrieving which patterns the grok processor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aunglish.

/// <para> </para>https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
/// </summary>
/// <param name="selector">An optional descriptor to further describe the endpoint usage operation</param>
IIngestProcessorGrokResponse IngestProcessorGrok(Func<IngestProcessorGrokDescriptor, IIngestProcessorGrokRequest> selector = null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the name of this API; Perhaps GrokProcessorPatterns? Happy to go with consensus here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure either, just picked a name, but happy to change it.

public class NodesUsageUnitTests
{
[U]
public void ShouldDeserialize()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is needed; ExpectResponse in NodesUsageApiTests is also testing deserialization?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fuller example.

const string indexName = ".monitoring-es-6-2017.07.21";
response.IndexSettings.Should().ContainKey(indexName);
response.IndexSettings[indexName].Count.Should().Be(1);
response.IndexSettings[indexName].First().Details.Should().Be("<anchor id=\"type: doc\" xreflabel=\"field: spins]\"/>");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pedant alert!: pull response.IndexSettings[indexName].First() out into variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

[U] public async Task Urls()
{
await GET("/_xpack/migration/deprecations")
.Fluent(c => c.DeprecationInfo(d => d))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove d => d

await GET("/_xpack/migration/deprecations")
.Fluent(c => c.DeprecationInfo(d => d))
.Request(c => c.DeprecationInfo(new DeprecationInfoRequest()))
.FluentAsync(c => c.DeprecationInfoAsync(d => d))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove d => d

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, 👍


protected override string UrlPath => $"/_ingest/processor/grok";

protected override IngestProcessorGrokDescriptor NewDescriptor() => new IngestProcessorGrokDescriptor();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

superfluous, can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

fixedResult = contentType == "application/json"
? serializer.SerializeToBytes(response)
: Encoding.UTF8.GetBytes(response.ToString());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather then supporting strings can we use anonymous c# objects in the tests for the expected json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went down that road originally, but I had to end up using JObject, which might have looked messier.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you need to use jobject?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Property name starts with a '.'

@codebrain codebrain merged commit 498c0c3 into feature/elasticsearch-6 Nov 14, 2017
@codebrain codebrain deleted the feature/elasticsearch-6-unmapped-endpoints branch November 14, 2017 04:32
Mpdreamz pushed a commit that referenced this pull request Nov 16, 2017
* Implementation of: GrokProcessorPatterns, NodesUsage and DeprecationInfo
Mpdreamz pushed a commit that referenced this pull request Nov 16, 2017
* Implementation of: GrokProcessorPatterns, NodesUsage and DeprecationInfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants