Skip to content
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
Expand Up @@ -15,6 +15,7 @@ public static class ApiEndpointsThatAllow404
"Delete",
"IndexExists",
"AliasExists",
"TemplateExists",
"TypeExists",
"Exists"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2838,12 +2838,12 @@ public AliasExistsRequestParameters Local(bool local)
///http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-templates.html
///</pre>
///</summary>
public class IndicesExistsTemplateRequestParameters : FluentRequestParameters<IndicesExistsTemplateRequestParameters>
public class TemplateExistsRequestParameters : FluentRequestParameters<TemplateExistsRequestParameters>
{

internal bool _local { get; set; }
///<summary>Return local information, do not retrieve the state from master node (default: false)</summary>
public IndicesExistsTemplateRequestParameters Local(bool local)
public TemplateExistsRequestParameters Local(bool local)
{
this._local = local;
this.AddQueryString("local", this._local);
Expand Down
1 change: 1 addition & 0 deletions src/Elasticsearch.Net/Elasticsearch.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<Compile Include="Domain\Response\VoidResponse.cs" />
<Compile Include="Domain\Response\ElasticsearchServerError.cs" />
<Compile Include="Exceptions\OneToOneServerException.cs" />
<Compile Include="Obsolete\IndicesTemplateExists.cs" />
<Compile Include="Obsolete\IndicesGetFieldMapping.cs" />
<Compile Include="Obsolete\Mpercolate.cs" />
<Compile Include="Obsolete\IndicesExistsType.cs" />
Expand Down
48 changes: 32 additions & 16 deletions src/Elasticsearch.Net/ElasticsearchClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12064,15 +12064,19 @@ public Task<ElasticsearchResponse<DynamicDictionary>> IndicesExistsAliasAsync(st
///<para> - If T is of type byte[] deserialization will be shortcircuited</para>
///<para> - If T is of type VoidResponse the response stream will be ignored completely</para>
///</returns>
public ElasticsearchResponse<T> IndicesExistsTemplateForAll<T>(string name, Func<IndicesExistsTemplateRequestParameters, IndicesExistsTemplateRequestParameters> requestParameters = null)
public ElasticsearchResponse<T> IndicesExistsTemplateForAll<T>(string name, Func<TemplateExistsRequestParameters, TemplateExistsRequestParameters> requestParameters = null)
{
name.ThrowIfNullOrEmpty("name");
var url = "_template/{0}".F(Encoded(name));
IRequestParameters requestParams = null;

if (requestParameters != null)
{
requestParams = requestParameters(new IndicesExistsTemplateRequestParameters());
requestParameters = requestParameters ?? (s => s);
var passIn = new TemplateExistsRequestParameters();
requestParams = requestParameters(passIn);
if (requestParams.RequestConfiguration == null)
requestParams.RequestConfiguration = new RequestConfiguration { AllowedStatusCodes = new [] { 404 } };
else {
requestParams.RequestConfiguration.AllowedStatusCodes = new [] { 404 };
}


Expand All @@ -12098,15 +12102,19 @@ public ElasticsearchResponse<T> IndicesExistsTemplateForAll<T>(string name, Func
///<para> - If T is of type byte[] deserialization will be shortcircuited</para>
///<para> - If T is of type VoidResponse the response stream will be ignored completely</para>
///</returns>
public Task<ElasticsearchResponse<T>> IndicesExistsTemplateForAllAsync<T>(string name, Func<IndicesExistsTemplateRequestParameters, IndicesExistsTemplateRequestParameters> requestParameters = null)
public Task<ElasticsearchResponse<T>> IndicesExistsTemplateForAllAsync<T>(string name, Func<TemplateExistsRequestParameters, TemplateExistsRequestParameters> requestParameters = null)
{
name.ThrowIfNullOrEmpty("name");
var url = "_template/{0}".F(Encoded(name));
IRequestParameters requestParams = null;

if (requestParameters != null)
{
requestParams = requestParameters(new IndicesExistsTemplateRequestParameters());
requestParameters = requestParameters ?? (s => s);
var passIn = new TemplateExistsRequestParameters();
requestParams = requestParameters(passIn);
if (requestParams.RequestConfiguration == null)
requestParams.RequestConfiguration = new RequestConfiguration { AllowedStatusCodes = new [] { 404 } };
else {
requestParams.RequestConfiguration.AllowedStatusCodes = new [] { 404 };
}


Expand Down Expand Up @@ -12134,15 +12142,19 @@ public Task<ElasticsearchResponse<T>> IndicesExistsTemplateForAllAsync<T>(string
///<para> - i.e result.Response.hits.hits[0].property.nested["nested_deeper"]</para>
///<para> - can be safely dispatched to a nullable type even if intermediate properties do not exist</para>
///</returns>
public ElasticsearchResponse<DynamicDictionary> IndicesExistsTemplateForAll(string name, Func<IndicesExistsTemplateRequestParameters, IndicesExistsTemplateRequestParameters> requestParameters = null)
public ElasticsearchResponse<DynamicDictionary> IndicesExistsTemplateForAll(string name, Func<TemplateExistsRequestParameters, TemplateExistsRequestParameters> requestParameters = null)
{
name.ThrowIfNullOrEmpty("name");
var url = "_template/{0}".F(Encoded(name));
IRequestParameters requestParams = null;

if (requestParameters != null)
{
requestParams = requestParameters(new IndicesExistsTemplateRequestParameters());
requestParameters = requestParameters ?? (s => s);
var passIn = new TemplateExistsRequestParameters();
requestParams = requestParameters(passIn);
if (requestParams.RequestConfiguration == null)
requestParams.RequestConfiguration = new RequestConfiguration { AllowedStatusCodes = new [] { 404 } };
else {
requestParams.RequestConfiguration.AllowedStatusCodes = new [] { 404 };
}


Expand Down Expand Up @@ -12170,15 +12182,19 @@ public ElasticsearchResponse<DynamicDictionary> IndicesExistsTemplateForAll(stri
///<para> - i.e result.Response.hits.hits[0].property.nested["nested_deeper"]</para>
///<para> - can be safely dispatched to a nullable type even if intermediate properties do not exist</para>
///</returns>
public Task<ElasticsearchResponse<DynamicDictionary>> IndicesExistsTemplateForAllAsync(string name, Func<IndicesExistsTemplateRequestParameters, IndicesExistsTemplateRequestParameters> requestParameters = null)
public Task<ElasticsearchResponse<DynamicDictionary>> IndicesExistsTemplateForAllAsync(string name, Func<TemplateExistsRequestParameters, TemplateExistsRequestParameters> requestParameters = null)
{
name.ThrowIfNullOrEmpty("name");
var url = "_template/{0}".F(Encoded(name));
IRequestParameters requestParams = null;

if (requestParameters != null)
{
requestParams = requestParameters(new IndicesExistsTemplateRequestParameters());
requestParameters = requestParameters ?? (s => s);
var passIn = new TemplateExistsRequestParameters();
requestParams = requestParameters(passIn);
if (requestParams.RequestConfiguration == null)
requestParams.RequestConfiguration = new RequestConfiguration { AllowedStatusCodes = new [] { 404 } };
else {
requestParams.RequestConfiguration.AllowedStatusCodes = new [] { 404 };
}


Expand Down
8 changes: 4 additions & 4 deletions src/Elasticsearch.Net/IElasticsearchClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6392,7 +6392,7 @@ public interface IElasticsearchClient
///<para> - If T is of type VoidResponse the response stream will be ignored completely</para>
///</returns>

ElasticsearchResponse<T> IndicesExistsTemplateForAll<T>(string name, Func<IndicesExistsTemplateRequestParameters, IndicesExistsTemplateRequestParameters> requestParameters = null);
ElasticsearchResponse<T> IndicesExistsTemplateForAll<T>(string name, Func<TemplateExistsRequestParameters, TemplateExistsRequestParameters> requestParameters = null);

///<summary>Represents a HEAD on /_template/{name}
///<para></para>Returns: A task that'll return an ElasticsearchResponse&lt;T&gt; holding the reponse body deserialized as T.
Expand All @@ -6410,7 +6410,7 @@ public interface IElasticsearchClient
///<para> - If T is of type VoidResponse the response stream will be ignored completely</para>
///</returns>

Task<ElasticsearchResponse<T>> IndicesExistsTemplateForAllAsync<T>(string name, Func<IndicesExistsTemplateRequestParameters, IndicesExistsTemplateRequestParameters> requestParameters = null);
Task<ElasticsearchResponse<T>> IndicesExistsTemplateForAllAsync<T>(string name, Func<TemplateExistsRequestParameters, TemplateExistsRequestParameters> requestParameters = null);

///<summary>Represents a HEAD on /_template/{name}
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; holding the response body deserialized as DynamicDictionary
Expand All @@ -6430,7 +6430,7 @@ public interface IElasticsearchClient
///<para> - can be safely dispatched to a nullable type even if intermediate properties do not exist</para>
///</returns>

ElasticsearchResponse<DynamicDictionary> IndicesExistsTemplateForAll(string name, Func<IndicesExistsTemplateRequestParameters, IndicesExistsTemplateRequestParameters> requestParameters = null);
ElasticsearchResponse<DynamicDictionary> IndicesExistsTemplateForAll(string name, Func<TemplateExistsRequestParameters, TemplateExistsRequestParameters> requestParameters = null);

///<summary>Represents a HEAD on /_template/{name}
///<para></para>Returns: Task that'll return an ElasticsearchResponse&lt;T$gt; holding the response body deserialized as DynamicDictionary
Expand All @@ -6450,7 +6450,7 @@ public interface IElasticsearchClient
///<para> - can be safely dispatched to a nullable type even if intermediate properties do not exist</para>
///</returns>

Task<ElasticsearchResponse<DynamicDictionary>> IndicesExistsTemplateForAllAsync(string name, Func<IndicesExistsTemplateRequestParameters, IndicesExistsTemplateRequestParameters> requestParameters = null);
Task<ElasticsearchResponse<DynamicDictionary>> IndicesExistsTemplateForAllAsync(string name, Func<TemplateExistsRequestParameters, TemplateExistsRequestParameters> requestParameters = null);

///<summary>Represents a HEAD on /{index}/{type}
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; holding the reponse body deserialized as T.
Expand Down
48 changes: 48 additions & 0 deletions src/Elasticsearch.Net/Obsolete/IndicesTemplateExists.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Elasticsearch.Net
{
#pragma warning disable 0618
using IndicesExistsTemplateSelector = Func<IndicesExistsTemplateRequestParameters , IndicesExistsTemplateRequestParameters >;
#pragma warning restore 0618

[Obsolete("Scheduled to be removed in 2.0, renamed to AliasExistsRequestParameters")]
public class IndicesExistsTemplateRequestParameters : TemplateExistsRequestParameters { }

public static class IndicesExistsTemplateClientExtensions
{
[Obsolete("Scheduled to be removed in 2.0, use the method that takes a Func of IndicesExistsRequestParameters")]
public static ElasticsearchResponse<T> IndicesExistsTemplateForAll<T>(this IElasticsearchClient client, string name, IndicesExistsTemplateSelector requestParameters = null)
{
var selector = Obsolete.UpCastSelector<IndicesExistsTemplateRequestParameters, TemplateExistsRequestParameters>(requestParameters);
return client.IndicesExistsTemplateForAll<T>(name, requestParameters);
}

[Obsolete("Scheduled to be removed in 2.0, use the method that takes a Func of IndicesExistsRequestParameters")]
public static Task<ElasticsearchResponse<T>> IndicesExistsTemplateForAllAsync<T>(this IElasticsearchClient client, string name, IndicesExistsTemplateSelector requestParameters = null)
{
var selector = Obsolete.UpCastSelector<IndicesExistsTemplateRequestParameters, TemplateExistsRequestParameters>(requestParameters);
return client.IndicesExistsTemplateForAllAsync<T>(name, requestParameters);
}

[Obsolete("Scheduled to be removed in 2.0, use the method that takes a Func of IndicesExistsRequestParameters")]
public static ElasticsearchResponse<DynamicDictionary> IndicesExistsTemplateForAll(this IElasticsearchClient client, string name, IndicesExistsTemplateSelector requestParameters = null)
{
var selector = Obsolete.UpCastSelector<IndicesExistsTemplateRequestParameters, TemplateExistsRequestParameters>(requestParameters);
return client.IndicesExistsTemplateForAll(name, requestParameters);
}

[Obsolete("Scheduled to be removed in 2.0, use the method that takes a Func of IndicesExistsRequestParameters")]
public static Task<ElasticsearchResponse<DynamicDictionary>> IndicesExistsTemplateForAllAsync(this IElasticsearchClient client, string name, IndicesExistsTemplateSelector requestParameters = null)
{
var selector = Obsolete.UpCastSelector<IndicesExistsTemplateRequestParameters, TemplateExistsRequestParameters>(requestParameters);
return client.IndicesExistsTemplateForAllAsync(name, requestParameters);
}


}
}
37 changes: 37 additions & 0 deletions src/Nest/DSL/TemplateExistsDescriptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Elasticsearch.Net;
using Newtonsoft.Json;

namespace Nest
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public interface ITemplateExistsRequest : INamePath<TemplateExistsRequestParameters> { }

internal static class TemplateExistsPathInfo
{
public static void Update(ElasticsearchPathInfo<TemplateExistsRequestParameters> pathInfo, ITemplateExistsRequest request)
{
pathInfo.HttpMethod = PathInfoHttpMethod.HEAD;
}
}

public partial class TemplateExistsRequest : NamePathBase<TemplateExistsRequestParameters>, ITemplateExistsRequest
{
public TemplateExistsRequest(string name) : base(name) { }

protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<TemplateExistsRequestParameters> pathInfo)
{
TemplateExistsPathInfo.Update(pathInfo, this);
}
}
[DescriptorFor("IndicesExistsTemplate")]
public partial class TemplateExistsDescriptor : NamePathDescriptor<TemplateExistsDescriptor, TemplateExistsRequestParameters>, ITemplateExistsRequest
{
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<TemplateExistsRequestParameters> pathInfo)
{
TemplateExistsPathInfo.Update(pathInfo, this);
}
}
}
10 changes: 2 additions & 8 deletions src/Nest/DSL/_Descriptors.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2729,24 +2729,18 @@ public AliasExistsDescriptor Local(bool local = true)
///http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-templates.html
///</pre>
///</summary>
public partial class IndicesExistsTemplateDescriptor : BaseRequest<IndicesExistsTemplateRequestParameters>
public partial class TemplateExistsDescriptor
{



///<summary>Return local information, do not retrieve the state from master node (default: false)</summary>
public IndicesExistsTemplateDescriptor Local(bool local = true)
public TemplateExistsDescriptor Local(bool local = true)
{
this.Request.RequestParameters.Local(local);
return this;
}


protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<IndicesExistsTemplateRequestParameters> pathInfo)
{
throw new NotImplementedException();
}


}

Expand Down
8 changes: 1 addition & 7 deletions src/Nest/DSL/_Requests.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2480,7 +2480,7 @@ public bool Local
///http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-templates.html
///</pre>
///</summary>
public partial class IndicesExistsTemplateRequest : BasePathRequest<IndicesExistsTemplateRequestParameters>
public partial class TemplateExistsRequest
{

///<summary>Return local information, do not retrieve the state from master node (default: false)</summary>
Expand All @@ -2490,12 +2490,6 @@ public bool Local
set { this.Request.RequestParameters.AddQueryString("local", value); }
}


protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<IndicesExistsTemplateRequestParameters> pathInfo)
{
throw new NotImplementedException();
}

}


Expand Down
59 changes: 59 additions & 0 deletions src/Nest/ElasticClient-TemplateExists.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Elasticsearch.Net;

namespace Nest
{
using TemplateExistConverter = Func<IElasticsearchResponse, Stream, ExistsResponse>;

public partial class ElasticClient
{
/// <inheritdoc />
public IExistsResponse TemplateExists(Func<TemplateExistsDescriptor, TemplateExistsDescriptor> selector)
{
return this.Dispatch<TemplateExistsDescriptor, TemplateExistsRequestParameters, ExistsResponse>(
selector,
(p, d) => this.RawDispatch.IndicesExistsTemplateDispatch<ExistsResponse>(
p.DeserializationState(new TemplateExistConverter(DeserializeExistsResponse))
)
);
}

/// <inheritdoc />
public IExistsResponse TemplateExists(ITemplateExistsRequest templateRequest)
{
return this.Dispatch<ITemplateExistsRequest, TemplateExistsRequestParameters, ExistsResponse>(
templateRequest,
(p, d) => this.RawDispatch.IndicesExistsTemplateDispatch<ExistsResponse>(
p.DeserializationState(new TemplateExistConverter(DeserializeExistsResponse))
)
);
}

/// <inheritdoc />
public Task<IExistsResponse> TemplateExistsAsync(Func<TemplateExistsDescriptor, TemplateExistsDescriptor> selector)
{
return this.DispatchAsync<TemplateExistsDescriptor, TemplateExistsRequestParameters, ExistsResponse, IExistsResponse>(
selector,
(p, d) => this.RawDispatch.IndicesExistsTemplateDispatchAsync<ExistsResponse>(
p.DeserializationState(new TemplateExistConverter(DeserializeExistsResponse))
)
);
}

/// <inheritdoc />
public Task<IExistsResponse> TemplateExistsAsync(ITemplateExistsRequest templateRequest)
{
return this.DispatchAsync<ITemplateExistsRequest, TemplateExistsRequestParameters, ExistsResponse, IExistsResponse>(
templateRequest,
(p, d) => this.RawDispatch.IndicesExistsTemplateDispatchAsync<ExistsResponse>(
p.DeserializationState(new TemplateExistConverter(DeserializeExistsResponse))
)
);
}

}
}
12 changes: 12 additions & 0 deletions src/Nest/IElasticClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,5 +1306,17 @@ Task<IGetFieldMappingResponse> GetFieldMappingAsync<T>(Func<GetFieldMappingDescr

/// <inheritdoc />
Task<IGetFieldMappingResponse> GetFieldMappingAsync(IGetFieldMappingRequest getFieldMappingRequest);

/// <inheritdoc />
IExistsResponse TemplateExists(Func<TemplateExistsDescriptor, TemplateExistsDescriptor> selector);

/// <inheritdoc />
IExistsResponse TemplateExists(ITemplateExistsRequest templateRequest);

/// <inheritdoc />
Task<IExistsResponse> TemplateExistsAsync(Func<TemplateExistsDescriptor, TemplateExistsDescriptor> selector);

/// <inheritdoc />
Task<IExistsResponse> TemplateExistsAsync(ITemplateExistsRequest templateRequest);
}
}
2 changes: 2 additions & 0 deletions src/Nest/Nest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
<Compile Include="Domain\Responses\GetFieldMappingResponse.cs" />
<Compile Include="Domain\Responses\MultiPercolateResponse.cs" />
<Compile Include="Domain\Responses\NodesHotThreadsResponse.cs" />
<Compile Include="DSL\TemplateExistsDescriptor.cs" />
<Compile Include="DSL\Filter\GeoShapeCircleFilterDescriptor.cs" />
<Compile Include="DSL\Filter\GeoShapeMultiLineStringFilterDescriptor.cs" />
<Compile Include="DSL\Filter\GeoShapeMultiPointFilterDescriptor.cs" />
Expand Down Expand Up @@ -252,6 +253,7 @@
<Compile Include="DSL\Visitor\QueryVisitor.cs" />
<Compile Include="DSL\Visitor\VisitorScope.cs" />
<Compile Include="DSL\_Requests.generated.cs" />
<Compile Include="ElasticClient-TemplateExists.cs" />
<Compile Include="ElasticClient-AliasExists.cs" />
<Compile Include="ElasticClient-ClusterSettings.cs" />
<Compile Include="ElasticClient-DeleteIndex.cs" />
Expand Down
Loading