-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathPlainRequest.cs
83 lines (73 loc) · 2.46 KB
/
PlainRequest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// 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;
using System.Text.Json.Serialization;
using Elastic.Transport;
#if ELASTICSEARCH_SERVERLESS
namespace Elastic.Clients.Elasticsearch.Serverless.Requests;
#else
namespace Elastic.Clients.Elasticsearch.Requests;
#endif
public abstract class PlainRequest<TParameters> : Request<TParameters>
where TParameters : RequestParameters, new()
{
// This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class.
// We don't expect consumers to derive from this public base class.
internal PlainRequest() { }
protected PlainRequest(Func<RouteValues, RouteValues> pathSelector) : base(pathSelector) { }
///<summary>Include the stack trace of returned errors.</summary>
[JsonIgnore]
public bool? ErrorTrace
{
get => Q<bool?>("error_trace");
set => Q("error_trace", value);
}
/// <summary>
/// A 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>
[JsonIgnore]
public string[] FilterPath
{
get => Q<string[]>("filter_path");
set => Q("filter_path", value);
}
///<summary>Return human-readable values for statistics.</summary>
[JsonIgnore]
public bool? Human
{
get => Q<bool?>("human");
set => Q("human", value);
}
///<summary>Pretty format the returned JSON response.</summary>
[JsonIgnore]
public bool? Pretty
{
get => Q<bool?>("pretty");
set => Q("pretty", value);
}
/// <summary>
/// The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST
/// requests.
/// </summary>
[JsonIgnore]
public string SourceQueryString
{
get => Q<string>("source");
set => Q("source", value);
}
/// <summary>
/// Specify settings for this request alone, handy if you need a custom timeout or want to bypass sniffing, retries
/// </summary>
[JsonIgnore]
public IRequestConfiguration RequestConfiguration
{
get => RequestParameters.RequestConfiguration;
set => RequestParameters.RequestConfiguration = value;
}
}