IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.

Deprecation logging

edit

Elasticsearch will send back Warn HTTP Headers when you are using an API feature that is deprecated and will be removed or rewritten in a future release.

Elasticsearch.NET and NEST report these back to you so you can log and watch out for them.

var response = this.Client.Search<Project>(s => s
    .FielddataFields(fd => fd
        .Field(p => p.State)
        .Field(p => p.NumberOfCommits)
    )
    .ScriptFields(sfs => sfs
        .ScriptField("commit_factor", sf => sf
            .Inline("doc['numberOfCommits'].value * 2")
            .Lang("groovy")
        )
    )
);

response.ApiCall.DeprecationWarnings.Should().NotBeNullOrEmpty();

response.DebugInformation.Should().Contain("Server indicated deprecations:"); 

DebugInformation also contains the deprecation warnings