Skip to content

Move explain to body in search template API #6098

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 3 commits into from
Feb 1, 2022
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
@@ -0,0 +1,17 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Collections.Generic;

namespace ApiGenerator.Configuration.Overrides.Endpoints
{
// ReSharper disable once UnusedMember.Global
public class SearchTemplateOverrides : EndpointOverridesBase
{
public override IEnumerable<string> SkipQueryStringParams => new[]
{
"explain"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2009,13 +2009,6 @@ public ExpandWildcards? ExpandWildcards
set => Q("expand_wildcards", value);
}

///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
public bool? Explain
{
get => Q<bool? >("explain");
set => Q("explain", value);
}

///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
public bool? IgnoreThrottled
{
Expand Down
2 changes: 0 additions & 2 deletions src/Nest/Descriptors.NoNamespace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1435,8 +1435,6 @@ public SearchTemplateDescriptor<TDocument> Index<TOther>()
public SearchTemplateDescriptor<TDocument> CcsMinimizeRoundtrips(bool? ccsminimizeroundtrips = true) => Qs("ccs_minimize_roundtrips", ccsminimizeroundtrips);
///<summary>Whether to expand wildcard expression to concrete indices that are open, closed or both.</summary>
public SearchTemplateDescriptor<TDocument> ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards);
///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
public SearchTemplateDescriptor<TDocument> Explain(bool? explain = true) => Qs("explain", explain);
///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
public SearchTemplateDescriptor<TDocument> IgnoreThrottled(bool? ignorethrottled = true) => Qs("ignore_throttled", ignorethrottled);
///<summary>Whether specified concrete indices should be ignored when unavailable (missing or closed)</summary>
Expand Down
7 changes: 0 additions & 7 deletions src/Nest/Requests.NoNamespace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3104,13 +3104,6 @@ public ExpandWildcards? ExpandWildcards
set => Q("expand_wildcards", value);
}

///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
public bool? Explain
{
get => Q<bool? >("explain");
set => Q("explain", value);
}

///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
public bool? IgnoreThrottled
{
Expand Down
10 changes: 10 additions & 0 deletions src/Nest/Search/SearchTemplate/SearchTemplateRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public partial interface ISearchTemplateRequest : ITypedSearchRequest

[DataMember(Name ="source")]
string Source { get; set; }

[DataMember(Name = "explain")]
public bool? Explain { get; set; }
}

public partial class SearchTemplateRequest
Expand All @@ -30,6 +33,9 @@ public partial class SearchTemplateRequest
public IDictionary<string, object> Params { get; set; }

public string Source { get; set; }

public bool? Explain { get; set; }

protected Type ClrType { get; set; }
Type ITypedSearchRequest.ClrType => ClrType;

Expand All @@ -54,6 +60,8 @@ public partial class SearchTemplateDescriptor<TDocument> where TDocument : class

string ISearchTemplateRequest.Source { get; set; }

bool? ISearchTemplateRequest.Explain { get; set; }

protected sealed override void RequestDefaults(SearchTemplateRequestParameters parameters) => TypedKeys();

public SearchTemplateDescriptor<TDocument> Source(string template) => Assign(template, (a, v) => a.Source = v);
Expand All @@ -64,5 +72,7 @@ public partial class SearchTemplateDescriptor<TDocument> where TDocument : class

public SearchTemplateDescriptor<TDocument> Params(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> paramDictionary) =>
Assign(paramDictionary, (a, v) => a.Params = v?.Invoke(new FluentDictionary<string, object>()));

public SearchTemplateDescriptor<TDocument> Explain(bool? explain = true) => Assign(explain, (a, v) => a.Explain = v);
}
}