Skip to content

Add note about filter_path and deserialization #3379

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 1 commit into from
Aug 29, 2018
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
6 changes: 6 additions & 0 deletions src/CodeGeneration/ApiGenerator/Domain/ApiQueryParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ public IEnumerable<string> DescriptionHighLevel
case "_source":
yield return "Whether the _source should be included in the response.";
yield break;
case "filter_path":
yield return this.Description;
yield return "<para>Use of response filtering can result in a response from Elasticsearch ";
yield return "that cannot be correctly deserialized to the respective response type for the request. ";
yield return "In such situations, use the low level client to issue the request and handle response deserialization</para>";
yield break;
default:
yield return this.Description;
yield break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"filter_path": {
"type": "list",
"description": "A comma-separated list of filters used to reduce the respone."
"description": "A comma-separated list of filters used to reduce the response."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ namespace Nest
var original = common.QueryStringKey;
var t = @common.TypeHighLevel;
var tSuffix = (t == "bool" || t == "bool?") ? " = true" : "";
<text> public TDescriptor @(common.ClsName)(@common.TypeHighLevel @common.ClsArgumentName@tSuffix) => Qs("@original", @(common.ClsArgumentName));
</text>
<text> ///<summary>@(Raw(string.Join("", common.DescriptionHighLevel)))</summary>
public TDescriptor @(common.ClsName)(@common.TypeHighLevel @common.ClsArgumentName@tSuffix) => Qs("@original", @(common.ClsArgumentName));
</text>
}
}
@foreach (CsharpMethod method in Model.CsharpMethodsWithQueryStringInfo)
Expand Down
3 changes: 3 additions & 0 deletions src/Nest/CommonAbstractions/Request/RequestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public IRequestConfiguration RequestConfiguration
}
}

///<summary>
/// Base class for all Request descriptor types
///</summary>
public abstract partial class RequestDescriptorBase<TDescriptor, TParameters, TInterface> : RequestBase<TParameters>, IDescriptor
where TDescriptor : RequestDescriptorBase<TDescriptor, TParameters, TInterface>, TInterface
where TParameters : RequestParameters<TParameters>, new()
Expand Down
12 changes: 8 additions & 4 deletions src/Nest/_Generated/_Descriptors.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ namespace Nest
{
public abstract partial class RequestDescriptorBase<TDescriptor, TParameters, TInterface>
{
///<summary>Pretty format the returned JSON response.</summary>
public TDescriptor Pretty(bool? pretty = true) => Qs("pretty", pretty);
public TDescriptor Human(bool? human = true) => Qs("human", human);
public TDescriptor ErrorTrace(bool? errorTrace = true) => Qs("error_trace", errorTrace);
public TDescriptor FilterPath(string[] filterPath) => Qs("filter_path", filterPath);
}
///<summary>Return human readable values for statistics.</summary>
public TDescriptor Human(bool? human = true) => Qs("human", human);
///<summary>Include the stack trace of returned errors.</summary>
public TDescriptor ErrorTrace(bool? errorTrace = true) => Qs("error_trace", errorTrace);
///<summary>A comma-separated list of filters used to reduce the response.<para>Use of response filtering can result in a response from Elasticsearch that cannot be correctly deserialized to the respective response type for the request. In such situations, use the low level client to issue the request and handle response deserialization</para></summary>
public TDescriptor FilterPath(string[] filterPath) => Qs("filter_path", filterPath);
}

///<summary>descriptor for Bulk <pre>http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html</pre></summary>
public partial class BulkDescriptor : RequestDescriptorBase<BulkDescriptor,BulkRequestParameters, IBulkRequest>, IBulkRequest
Expand Down
7 changes: 6 additions & 1 deletion src/Nest/_Generated/_Requests.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ public abstract partial class PlainRequestBase<TParameters>
public bool? Human { get => Q<bool?>("human"); set => Q("human", value); }
///<summary>Include the stack trace of returned errors.</summary>
public bool? ErrorTrace { get => Q<bool?>("error_trace"); set => Q("error_trace", value); }
///<summary>A comma-separated list of filters used to reduce the respone.</summary>
///<summary>
/// A comma-separated list of filters used to reduce the response.
/// <para>Use of response filtering can result in a response from Elasticsearch
/// that cannot be correctly deserialized to the respective response type for the request.
/// In such situations, use the low level client to issue the request and handle response deserialization</para>
///</summary>
public string[] FilterPath { get => Q<string[]>("filter_path"); set => Q("filter_path", value); }
}

Expand Down