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 @@ -4,7 +4,7 @@

namespace ApiGenerator.Overrides.Allow404
{
public static class ApiEndpointsThatAllow404
public static class ApiEndpointsThatAllow404
{
public static readonly IEnumerable<string> Endpoints = new List<string>
{
Expand All @@ -15,8 +15,8 @@ public static class ApiEndpointsThatAllow404
"IndexTemplateExists",
"TypeExists",
"Exists",
//"Get"
//"Delete",
"Get",
"Delete",
};
}
}
698 changes: 368 additions & 330 deletions src/CodeGeneration/ApiGenerator/RestSpecification/Core/root.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ public ElasticsearchResponse<T> CreatePost<T>(string index, string type, string
///<param name="id">The document ID</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public ElasticsearchResponse<T> Delete<T>(string index, string type, string id, Func<DeleteRequestParameters, DeleteRequestParameters> requestParameters = null)
where T : class => this.DoRequest<T>(DELETE, Url($"{index.NotNull("index")}/{type.NotNull("type")}/{id.NotNull("id")}"), null, _params(requestParameters));
where T : class => this.DoRequest<T>(DELETE, Url($"{index.NotNull("index")}/{type.NotNull("type")}/{id.NotNull("id")}"), null, _params(requestParameters, allow404: true));

///<summary>Represents a DELETE on /{index}/{type}/{id}
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
Expand All @@ -1780,7 +1780,7 @@ public ElasticsearchResponse<T> Delete<T>(string index, string type, string id,
///<param name="id">The document ID</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<ElasticsearchResponse<T>> DeleteAsync<T>(string index, string type, string id, Func<DeleteRequestParameters, DeleteRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
where T : class => this.DoRequestAsync<T>(DELETE, Url($"{index.NotNull("index")}/{type.NotNull("type")}/{id.NotNull("id")}"), cancellationToken, null, _params(requestParameters));
where T : class => this.DoRequestAsync<T>(DELETE, Url($"{index.NotNull("index")}/{type.NotNull("type")}/{id.NotNull("id")}"), cancellationToken, null, _params(requestParameters, allow404: true));

///<summary>Represents a POST on /{index}/_delete_by_query
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
Expand Down Expand Up @@ -2126,7 +2126,7 @@ public ElasticsearchResponse<T> FieldStats<T>(string index, PostData<object> bod
///<param name="id">The document ID</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public ElasticsearchResponse<T> Get<T>(string index, string type, string id, Func<GetRequestParameters, GetRequestParameters> requestParameters = null)
where T : class => this.DoRequest<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/{id.NotNull("id")}"), null, _params(requestParameters));
where T : class => this.DoRequest<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/{id.NotNull("id")}"), null, _params(requestParameters, allow404: true));

///<summary>Represents a GET on /{index}/{type}/{id}
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
Expand All @@ -2142,7 +2142,7 @@ public ElasticsearchResponse<T> Get<T>(string index, string type, string id, Fun
///<param name="id">The document ID</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<ElasticsearchResponse<T>> GetAsync<T>(string index, string type, string id, Func<GetRequestParameters, GetRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
where T : class => this.DoRequestAsync<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/{id.NotNull("id")}"), cancellationToken, null, _params(requestParameters));
where T : class => this.DoRequestAsync<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/{id.NotNull("id")}"), cancellationToken, null, _params(requestParameters, allow404: true));

///<summary>Represents a GET on /_scripts/{lang}/{id}
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
Expand Down
4 changes: 4 additions & 0 deletions src/Tests/Document/Single/DocumentCrudTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,9 @@ [I] protected async Task DocumentIsUpdated() => await this.AssertOnGetAfterUpdat
[I] protected async Task DocumentIsDeleted() => await this.AssertOnGetAfterDelete(r =>
r.Found.Should().BeFalse()
);

[I]protected override async Task GetAfterDeleteIsValid() => await this.AssertOnGetAfterDelete(r =>
r.ShouldBeValid()
);
}
}
1 change: 0 additions & 1 deletion src/Tests/Reproduce/GithubIssue1863.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Threading.Tasks;
using Elasticsearch.Net;
using Nest;
using FluentAssertions;
using Tests.Document.Multiple.Reindex;
using Tests.Framework;
Expand Down
33 changes: 33 additions & 0 deletions src/Tests/Reproduce/GithubIssue2306.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using FluentAssertions;
using Nest;
using Tests.Framework;
using Tests.Framework.Integration;
using Tests.Framework.MockData;
using Xunit;

namespace Tests.Reproduce
{
public class GithubIssue2306 : IClusterFixture<ReadOnlyCluster>
{
private readonly ReadOnlyCluster _cluster;

public GithubIssue2306(ReadOnlyCluster cluster)
{
_cluster = cluster;
}

[I]
public void DeleteNonExistentDocumentReturnsNotFound()
{
var client = _cluster.Client;
var response = client.Delete<Project>("non-existent-id");

response.ShouldBeValid();
response.Found.Should().BeFalse();
response.Result.Should().Be(Result.NotFound);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert .Index and the like as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

response.Index.Should().Be("project");
response.Type.Should().Be("project");
response.Id.Should().Be("non-existent-id");
}
}
}
1 change: 1 addition & 0 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@
<Compile Include="QueryDsl\Specialized\Percolate\PercolateQueryUsageTests.cs" />
<Compile Include="Reproduce\DateSerialization.cs" />
<Compile Include="Reproduce\GithubIssue2152.cs" />
<Compile Include="Reproduce\GithubIssue2306.cs" />
<Compile Include="Reproduce\GithubIssue2309.cs" />
<Compile Include="Search\MultiSearch\MultiSearchApiTests.cs" />
<Compile Include="Search\MultiSearch\MultiSearchInvalidApiTests.cs" />
Expand Down