-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added reproduce test to showcase #1906
- Loading branch information
Showing
5 changed files
with
51 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,4 +72,4 @@ | |
}, | ||
"body": null | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Elasticsearch.Net; | ||
using Nest; | ||
using FluentAssertions; | ||
using Tests.Framework; | ||
|
||
namespace Tests.Reproduce | ||
{ | ||
public class GithubIssue1906 | ||
{ | ||
private class ESLogEvent { } | ||
|
||
[U] public void SearchDoesNotTakeDefaultIndexIntoAccount() | ||
{ | ||
var node = new Uri("http://localhost:9200"); | ||
var connectionPool = new SingleNodeConnectionPool(node); | ||
var connectionSettings = new ConnectionSettings(connectionPool, connection: new InMemoryConnection()) | ||
.DefaultIndex("logstash-*") | ||
.DefaultFieldNameInferrer(p => p) | ||
.OnRequestCompleted(info => | ||
{ | ||
// info.Uri is /_search/ without the default index | ||
// my ES instance throws an error on the .kibana index (@timestamp field not mapped because I sort on @timestamp) | ||
}); | ||
|
||
var client = new ElasticClient(connectionSettings); | ||
var response = client.Search<ESLogEvent>(s=>s); | ||
|
||
response.ApiCall.Uri.AbsolutePath.Should().Be("/logstash-%2A/eslogevent/_search"); | ||
|
||
response = client.Search<ESLogEvent>(new SearchRequest<ESLogEvent>{ }); | ||
response.ApiCall.Uri.AbsolutePath.Should().Be("/logstash-%2A/eslogevent/_search"); | ||
|
||
response = client.Search<ESLogEvent>(new SearchRequest { }); | ||
response.ApiCall.Uri.AbsolutePath.Should().Be("/_search"); | ||
|
||
} | ||
} | ||
} |