Skip to content

Commit 3f53763

Browse files
committed
added reproduce test to showcase #1906
1 parent 7208634 commit 3f53763

File tree

5 files changed

+51
-18
lines changed

5 files changed

+51
-18
lines changed

.editorconfig

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
root=true
22

3+
[*.cs]
4+
trim_trailing_whitespace=true
5+
insert_final_newline=true
6+
37
[*]
48
indent_style = tab
59
indent_size = 4
@@ -8,22 +12,10 @@ indent_size = 4
812
indent_style = tab
913
indent_size = 4
1014

11-
[*.js]
12-
indent_style = space
13-
indent_size = 2
14-
15-
[*.fs]
16-
indent_style = space
17-
indent_size = 4
18-
19-
[*.fsx]
15+
[*.{fs,fsx}]
2016
indent_style = space
2117
indent_size = 4
2218

23-
[*.markdown]
24-
indent_style = space
25-
indent_size = 2
26-
27-
[*.json]
19+
[*.{md,markdown,json,js}]
2820
indent_style = space
2921
indent_size = 2

src/CodeGeneration/CodeGeneration.LowLevelClient/ApiEndpoints/get.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@
7272
},
7373
"body": null
7474
}
75-
}
75+
}

src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/CsharpMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,4 @@ public IEnumerable<FluentRouteSetter> GetFluentRouteSetters()
283283
public bool IsDocumentPath => AllParts.Count() == 3 && AllParts.All(p => p.Type != "list") && AllParts.All(p => new[] { "index", "type", "id" }.Contains(p.Name));
284284
public IEnumerable<ApiUrlPart> AllParts => (this.Url?.Parts?.Values ?? Enumerable.Empty<ApiUrlPart>()).Where(p => !string.IsNullOrWhiteSpace(p.Name));
285285
}
286-
}
286+
}

src/Elasticsearch.Net/IElasticLowLevelClient.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Elasticsearch.Net
44
{
55
public partial interface IElasticLowLevelClient
6-
{
6+
{
77
/// <summary>
88
/// Perform any request you want over the configured IConnection synchronously while taking advantage of the cluster failover.
99
/// </summary>
@@ -27,6 +27,5 @@ ElasticsearchResponse<T> DoRequest<T>(HttpMethod method, string path, PostData<o
2727
/// <returns>A task of ElasticsearchResponse of T where T represents the JSON response body</returns>
2828
Task<ElasticsearchResponse<T>> DoRequestAsync<T>(HttpMethod method, string path, PostData<object> data = null, IRequestParameters requestParameters = null)
2929
where T : class;
30-
3130
}
3231
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Elasticsearch.Net;
6+
using Nest;
7+
using FluentAssertions;
8+
using Tests.Framework;
9+
10+
namespace Tests.Reproduce
11+
{
12+
public class GithubIssue1906
13+
{
14+
private class ESLogEvent { }
15+
16+
[U] public void SearchDoesNotTakeDefaultIndexIntoAccount()
17+
{
18+
var node = new Uri("http://localhost:9200");
19+
var connectionPool = new SingleNodeConnectionPool(node);
20+
var connectionSettings = new ConnectionSettings(connectionPool, connection: new InMemoryConnection())
21+
.DefaultIndex("logstash-*")
22+
.DefaultFieldNameInferrer(p => p)
23+
.OnRequestCompleted(info =>
24+
{
25+
// info.Uri is /_search/ without the default index
26+
// my ES instance throws an error on the .kibana index (@timestamp field not mapped because I sort on @timestamp)
27+
});
28+
29+
var client = new ElasticClient(connectionSettings);
30+
var response = client.Search<ESLogEvent>(s=>s);
31+
32+
response.ApiCall.Uri.AbsolutePath.Should().Be("/logstash-%2A/eslogevent/_search");
33+
34+
response = client.Search<ESLogEvent>(new SearchRequest<ESLogEvent>{ });
35+
response.ApiCall.Uri.AbsolutePath.Should().Be("/logstash-%2A/eslogevent/_search");
36+
37+
response = client.Search<ESLogEvent>(new SearchRequest { });
38+
response.ApiCall.Uri.AbsolutePath.Should().Be("/_search");
39+
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)