Skip to content

Commit 8f611c6

Browse files
authored
Move explain to body in search template API (#6098)
* Move explain to body in search template API * Remove BOM * Correct descriptor default
1 parent 8f6fda0 commit 8f611c6

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
using System.Collections.Generic;
6+
7+
namespace ApiGenerator.Configuration.Overrides.Endpoints
8+
{
9+
// ReSharper disable once UnusedMember.Global
10+
public class SearchTemplateOverrides : EndpointOverridesBase
11+
{
12+
public override IEnumerable<string> SkipQueryStringParams => new[]
13+
{
14+
"explain"
15+
};
16+
}
17+
}

src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.NoNamespace.cs

-7
Original file line numberDiff line numberDiff line change
@@ -2009,13 +2009,6 @@ public ExpandWildcards? ExpandWildcards
20092009
set => Q("expand_wildcards", value);
20102010
}
20112011

2012-
///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
2013-
public bool? Explain
2014-
{
2015-
get => Q<bool? >("explain");
2016-
set => Q("explain", value);
2017-
}
2018-
20192012
///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
20202013
public bool? IgnoreThrottled
20212014
{

src/Nest/Descriptors.NoNamespace.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1435,8 +1435,6 @@ public SearchTemplateDescriptor<TDocument> Index<TOther>()
14351435
public SearchTemplateDescriptor<TDocument> CcsMinimizeRoundtrips(bool? ccsminimizeroundtrips = true) => Qs("ccs_minimize_roundtrips", ccsminimizeroundtrips);
14361436
///<summary>Whether to expand wildcard expression to concrete indices that are open, closed or both.</summary>
14371437
public SearchTemplateDescriptor<TDocument> ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards);
1438-
///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
1439-
public SearchTemplateDescriptor<TDocument> Explain(bool? explain = true) => Qs("explain", explain);
14401438
///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
14411439
public SearchTemplateDescriptor<TDocument> IgnoreThrottled(bool? ignorethrottled = true) => Qs("ignore_throttled", ignorethrottled);
14421440
///<summary>Whether specified concrete indices should be ignored when unavailable (missing or closed)</summary>

src/Nest/Requests.NoNamespace.cs

-7
Original file line numberDiff line numberDiff line change
@@ -3104,13 +3104,6 @@ public ExpandWildcards? ExpandWildcards
31043104
set => Q("expand_wildcards", value);
31053105
}
31063106

3107-
///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
3108-
public bool? Explain
3109-
{
3110-
get => Q<bool? >("explain");
3111-
set => Q("explain", value);
3112-
}
3113-
31143107
///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
31153108
public bool? IgnoreThrottled
31163109
{

src/Nest/Search/SearchTemplate/SearchTemplateRequest.cs

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public partial interface ISearchTemplateRequest : ITypedSearchRequest
2121

2222
[DataMember(Name ="source")]
2323
string Source { get; set; }
24+
25+
[DataMember(Name = "explain")]
26+
public bool? Explain { get; set; }
2427
}
2528

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

3235
public string Source { get; set; }
36+
37+
public bool? Explain { get; set; }
38+
3339
protected Type ClrType { get; set; }
3440
Type ITypedSearchRequest.ClrType => ClrType;
3541

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

5561
string ISearchTemplateRequest.Source { get; set; }
5662

63+
bool? ISearchTemplateRequest.Explain { get; set; }
64+
5765
protected sealed override void RequestDefaults(SearchTemplateRequestParameters parameters) => TypedKeys();
5866

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

6573
public SearchTemplateDescriptor<TDocument> Params(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> paramDictionary) =>
6674
Assign(paramDictionary, (a, v) => a.Params = v?.Invoke(new FluentDictionary<string, object>()));
75+
76+
public SearchTemplateDescriptor<TDocument> Explain(bool? explain = true) => Assign(explain, (a, v) => a.Explain = v);
6777
}
6878
}

0 commit comments

Comments
 (0)