Skip to content

Commit 84fdfba

Browse files
committed
new ElasticsearchClient() and new ElasticClient() work now, defaults to localhost:9200
1 parent 1a672e2 commit 84fdfba

File tree

14 files changed

+167
-106
lines changed

14 files changed

+167
-106
lines changed

build/NEST.nuspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>NEST</id>
5-
<version>0.9.0.0</version>
5+
<version>0.0.0.1</version>
66
<title>NEST - Elasticsearch Client</title>
77
<authors>Martijn Laarman and contributors</authors>
88
<owners>Martijn Laarman</owners>
9-
<iconUrl>http://nest.azurewebsites.net/images/nuget-icon.png</iconUrl>
9+
<iconUrl>http://nest.azurewebsites.net/images/nest-nuget-icon.png</iconUrl>
1010
<licenseUrl>http://mpdreamz.mit-license.org/</licenseUrl>
1111
<projectUrl>https://github.com/Mpdreamz/NEST</projectUrl>
12-
<summary>Elasticsearch client, strongly typed interface to Elasticsearch but also comes with great low level support.</summary>
12+
<summary>Strongly typed interface to Elasticsearch. Fluent request builder, mapped responses and powerful query dsl. Uses and exposes Elasticsearch.Net</summary>
1313
<requireLicenseAcceptance>false</requireLicenseAcceptance>
14-
<description>Elasticsearch client, strongly typed interface to Elasticsearch but also comes with great low level support.</description>
14+
<description>Elasticsearch client, strongly typed interface to Elasticsearch. Fluent request builder, mapped responses and powerful query dsl. Uses and exposes Elasticsearch.Net</description>
1515
<dependencies>
16+
<dependency id="Elasticsearch.Net" />
1617
<dependency id="Newtonsoft.Json" version="6.0.1" />
1718
</dependencies>
1819
<tags>elasticsearch elastic search lucene nest</tags>

build/Nest.Connection.Thrift.nuspec

Lines changed: 0 additions & 27 deletions
This file was deleted.

build/build.fsx

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ Target "Test" (fun _ ->
3030
)
3131
)
3232

33-
34-
3533
let keyFile = "build/keys/keypair.snk"
3634
let validateSignedAssembly = fun (name) ->
3735
let sn = "build/tools/sn/sn.exe"
@@ -66,6 +64,22 @@ let signAssembly = fun (name) ->
6664
| _ ->
6765
failwithf "Failed to sign {0}" name
6866

67+
let nugetPack = fun (name) ->
68+
69+
CreateDir nugetOutDir
70+
71+
let dir = sprintf "%s/%s/" buildDir name
72+
let version = "1.0.0-alpha1"
73+
NuGetPack (fun p ->
74+
{p with
75+
Version = version
76+
WorkingDir = dir
77+
OutputPath = dir
78+
})
79+
(sprintf @"build\%s.nuspec" name)
80+
81+
MoveFile nugetOutDir (buildDir + (sprintf "%s/%s.%s.nupkg" name name version))
82+
6983
Target "Release" (fun _ ->
7084
if not <| fileExists keyFile
7185
then failwithf "{0} does not exist to sign the assemblies" keyFile
@@ -74,17 +88,10 @@ Target "Release" (fun _ ->
7488
signAssembly("Elasticsearch.Net.Connection.Thrift")
7589
signAssembly("Nest")
7690

77-
CreateDir nugetOutDir
78-
79-
NuGetPack (fun p ->
80-
{p with
81-
Version = "1.0.0.0"
82-
WorkingDir = buildDir + "/Nest/"
83-
OutputPath = buildDir + "/Nest/"
84-
})
85-
"build\NEST.nuspec"
86-
87-
MoveFile nugetOutDir (buildDir + (sprintf "Nest/NEST.%s.nupkg" "1.0.0.0"))
91+
nugetPack("Elasticsearch.Net")
92+
nugetPack("Elasticsearch.Net.Connection.Thrift")
93+
nugetPack("Nest")
94+
8895
)
8996

9097
// Dependencies
@@ -93,8 +100,8 @@ Target "Release" (fun _ ->
93100
==> "Test"
94101
==> "Build"
95102

96-
//"Build"
97-
// ==> "Release"
103+
"Build"
104+
==> "Release"
98105

99106
// start build
100107
RunTargetOrDefault "Build"

src/Connections/Elasticsearch.Net.Connection.Thrift/Elasticsearch.Net.Connection.Thrift.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<CodeAnalysisRuleDirectories>;d:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
5151
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
5252
<WarningLevel>4</WarningLevel>
53+
<DocumentationFile>bin\Release\Elasticsearch.Net.Connection.Thrift.XML</DocumentationFile>
5354
</PropertyGroup>
5455
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug - Generator|AnyCPU'">
5556
<DebugSymbols>true</DebugSymbols>

src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Collections.Specialized;
4+
using System.ComponentModel;
45
using System.Linq;
56
using Elasticsearch.Net.ConnectionPool;
67
using Elasticsearch.Net.Serialization;
78

89
namespace Elasticsearch.Net.Connection
910
{
11+
/// <summary>
12+
/// ConnectionConfiguration allows you to control how ElasticsearchClient behaves and where/how it connects
13+
/// to elasticsearch
14+
/// </summary>
1015
public class ConnectionConfiguration :
1116
ConnectionConfiguration<ConnectionConfiguration>,
12-
IConnectionConfiguration<ConnectionConfiguration>
17+
IConnectionConfiguration<ConnectionConfiguration>,
18+
IHideObjectMembers
1319
{
20+
/// <summary>
21+
/// ConnectionConfiguration allows you to control how ElasticsearchClient behaves and where/how it connects
22+
/// to elasticsearch
23+
/// </summary>
24+
/// <param name="uri">The root of the elasticsearch node we want to connect to. Defaults to http://localhost:9200</param>
1425
public ConnectionConfiguration(Uri uri = null)
1526
: base(uri)
1627
{
1728

1829
}
30+
31+
/// <summary>
32+
/// ConnectionConfiguration allows you to control how ElasticsearchClient behaves and where/how it connects
33+
/// to elasticsearch
34+
/// </summary>
35+
/// <param name="connectionPool">A connection pool implementation that'll tell the client what nodes are available</param>
1936
public ConnectionConfiguration(IConnectionPool connectionPool)
2037
: base(connectionPool)
2138
{
@@ -24,7 +41,9 @@ public ConnectionConfiguration(IConnectionPool connectionPool)
2441
}
2542

2643

27-
public class ConnectionConfiguration<T> : IConnectionConfigurationValues
44+
[Browsable(false)]
45+
[EditorBrowsable(EditorBrowsableState.Never)]
46+
public class ConnectionConfiguration<T> : IConnectionConfigurationValues, IHideObjectMembers
2847
where T : ConnectionConfiguration<T>
2948
{
3049
private IConnectionPool _connectionPool;

src/Elasticsearch.Net/Connection/IConnectionConfiguration.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
namespace Elasticsearch.Net.Connection
55
{
66
public interface IConnectionConfiguration :
7-
IConnectionConfiguration<IConnectionConfiguration>
7+
IConnectionConfiguration<IConnectionConfiguration>,
8+
IHideObjectMembers
89
{
910

1011
}
1112

12-
public interface IConnectionConfiguration<out T> where T : IConnectionConfiguration<T>
13+
public interface IConnectionConfiguration<out T> : IHideObjectMembers
14+
where T : IConnectionConfiguration<T>
1315
{
1416

1517

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace Elasticsearch.Net
8+
{
9+
/// <summary>
10+
/// Helper interface used to hide the base <see cref="Object"/> members from the fluent API to make it much cleaner
11+
/// in Visual Studio intellisense.
12+
/// </summary>
13+
/// <remarks>Created by Daniel Cazzulino http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx</remarks>
14+
[Browsable(false)]
15+
[EditorBrowsable(EditorBrowsableState.Never)]
16+
public interface IHideObjectMembers
17+
{
18+
/// <summary>
19+
/// Hides the <see cref="Equals"/> method.
20+
/// </summary>
21+
[Browsable(false)]
22+
[EditorBrowsable(EditorBrowsableState.Never)]
23+
bool Equals(object obj);
24+
25+
/// <summary>
26+
/// Hides the <see cref="GetHashCode"/> method.
27+
/// </summary>
28+
[Browsable(false)]
29+
[EditorBrowsable(EditorBrowsableState.Never)]
30+
int GetHashCode();
31+
32+
/// <summary>
33+
/// Hides the <see cref="GetType"/> method.
34+
/// </summary>
35+
[Browsable(false)]
36+
[EditorBrowsable(EditorBrowsableState.Never)]
37+
Type GetType();
38+
39+
/// <summary>
40+
/// Hides the <see cref="ToString"/> method.
41+
/// </summary>
42+
[Browsable(false)]
43+
[EditorBrowsable(EditorBrowsableState.Never)]
44+
string ToString();
45+
}
46+
47+
}

src/Elasticsearch.Net/Elasticsearch.Net.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<DefineConstants>TRACE</DefineConstants>
3030
<ErrorReport>prompt</ErrorReport>
3131
<WarningLevel>4</WarningLevel>
32+
<DocumentationFile>bin\Release\Elasticsearch.Net.XML</DocumentationFile>
3233
</PropertyGroup>
3334
<ItemGroup>
3435
<Reference Include="PUrify">
@@ -44,6 +45,7 @@
4445
<Reference Include="System.Xml" />
4546
</ItemGroup>
4647
<ItemGroup>
48+
<Compile Include="Domain\IHideObjectMembers.cs" />
4749
<Compile Include="Domain\VoidResponse.cs" />
4850
<Compile Include="Providers\DateTimeProvider.cs" />
4951
<Compile Include="Connection\HttpConnection.cs" />

src/Elasticsearch.Net/ElasticsearchClient.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,36 @@
1010

1111
namespace Elasticsearch.Net
1212
{
13+
/// <summary>
14+
/// Low level client that exposes all of elasticsearch API endpoints but leaves you in charge of building request and handling the response
15+
/// </summary>
1316
public partial class ElasticsearchClient : IElasticsearchClient
1417
{
1518
public IConnectionConfigurationValues Settings { get { return this.Transport.Settings; } }
1619
public IElasticsearchSerializer Serializer { get { return this.Transport.Serializer; } }
1720

1821
protected IStringifier Stringifier { get; set; }
1922
protected ITransport Transport { get; set; }
20-
23+
24+
/// <summary>
25+
/// Instantiate a new low level elasticsearch client
26+
/// </summary>
27+
/// <param name="settings">Specify how and where the client connects to elasticsearch, defaults to a static single node connectionpool
28+
/// to http://localhost:9200
29+
/// </param>
30+
/// <param name="connection">Provide an alternative connection handler</param>
31+
/// <param name="transport">Provide a custom transport implementation that coordinates between IConnectionPool, IConnection and ISerializer</param>
32+
/// <param name="serializer">Provide a custom serializer</param>
33+
/// <param name="stringifier">This interface is responsible for translating non string objects in the querystring to strings</param>
2134
public ElasticsearchClient(
22-
IConnectionConfigurationValues settings,
35+
IConnectionConfigurationValues settings = null,
2336
IConnection connection = null,
2437
ITransport transport = null,
2538
IElasticsearchSerializer serializer = null,
2639
IStringifier stringifier = null
2740
)
2841
{
29-
if (settings == null)
30-
throw new ArgumentNullException("settings");
31-
42+
settings = settings ?? new ConnectionConfiguration();
3243
this.Transport = transport ?? new Transport(settings, connection, serializer);
3344
this.Stringifier = stringifier ?? new Stringifier();
3445

src/Elasticsearch.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build", "_Build", "{432D55
2424
..\.gitignore = ..\.gitignore
2525
..\build.bat = ..\build.bat
2626
..\build\build.fsx = ..\build\build.fsx
27-
..\build\Nest.Connection.Thrift.nuspec = ..\build\Nest.Connection.Thrift.nuspec
27+
..\build\Elasticsearch.Net.Connection.Thrift.nuspec = ..\build\Elasticsearch.Net.Connection.Thrift.nuspec
28+
..\build\Elasticsearch.Net.nuspec = ..\build\Elasticsearch.Net.nuspec
2829
..\build\NEST.nuspec = ..\build\NEST.nuspec
2930
..\build\NESTBuild.proj = ..\build\NESTBuild.proj
3031
EndProjectSection

0 commit comments

Comments
 (0)