Skip to content

Commit 2450113

Browse files
Move explain to body in search template API (#6098) (#6099)
* Move explain to body in search template API * Remove BOM * Correct descriptor default Co-authored-by: Steve Gordon <[email protected]>
1 parent 153d560 commit 2450113

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
@@ -2030,13 +2030,6 @@ public ExpandWildcards? ExpandWildcards
20302030
set => Q("expand_wildcards", value);
20312031
}
20322032

2033-
///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
2034-
public bool? Explain
2035-
{
2036-
get => Q<bool? >("explain");
2037-
set => Q("explain", value);
2038-
}
2039-
20402033
///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
20412034
public bool? IgnoreThrottled
20422035
{

src/Nest/Descriptors.NoNamespace.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1445,8 +1445,6 @@ public SearchTemplateDescriptor<TDocument> Index<TOther>()
14451445
public SearchTemplateDescriptor<TDocument> CcsMinimizeRoundtrips(bool? ccsminimizeroundtrips = true) => Qs("ccs_minimize_roundtrips", ccsminimizeroundtrips);
14461446
///<summary>Whether to expand wildcard expression to concrete indices that are open, closed or both.</summary>
14471447
public SearchTemplateDescriptor<TDocument> ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards);
1448-
///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
1449-
public SearchTemplateDescriptor<TDocument> Explain(bool? explain = true) => Qs("explain", explain);
14501448
///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
14511449
public SearchTemplateDescriptor<TDocument> IgnoreThrottled(bool? ignorethrottled = true) => Qs("ignore_throttled", ignorethrottled);
14521450
///<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
@@ -3125,13 +3125,6 @@ public ExpandWildcards? ExpandWildcards
31253125
set => Q("expand_wildcards", value);
31263126
}
31273127

3128-
///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
3129-
public bool? Explain
3130-
{
3131-
get => Q<bool? >("explain");
3132-
set => Q("explain", value);
3133-
}
3134-
31353128
///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
31363129
public bool? IgnoreThrottled
31373130
{

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)