Skip to content

Commit df21777

Browse files
committed
[Docs] Update 1.0 Breaking Changes
1 parent cc8163d commit df21777

File tree

1 file changed

+42
-27
lines changed

1 file changed

+42
-27
lines changed

docs/contents/breaking-changes.md

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,46 @@ Elasticsearch 1.0 comes with it's own set of breaking changes which [are all doc
1515

1616
### Strong Named Packages
1717

18-
Prior to 1.0 NEST came with a `NEST` and `NEST.Signed` nuget package. In 1.0 there is one package called `NEST` which is a signed strong named assembly. We follow the example of JSON.NET and only change our `AssemblyVersion` on major releases only update the `AssemblyFileVersion` for every release. This way you get most of the benefits of unsigned assemblies while still providing support for developers who's business guidelines mandates the usage of signed assemblies.
18+
Prior to 1.0 NEST came with a `NEST` and `NEST.Signed` nuget package. In 1.0 there is one package called `NEST` which is a signed strong named assembly. We follow the example of JSON.NET and only change our `AssemblyVersion` on major releases only update the `AssemblyFileVersion` for every release. This way you get most of the benefits of unsigned assemblies while still providing support for developers whose business guidelines mandates the usage of signed assemblies.
1919

2020

2121
### IElasticClient
2222

2323
The outer layer of NEST has been completely rewritten from scratch. Many calls will now have a different signature. Although the most common ones have been reimplemented as [extensions methods](http://github.com/elasticsearch/elasticsearch-net/tree/master/src/Nest/ConvenienceExtensions). Two notable changes should be outlined though.
2424

25-
#### Get() is now called Source()
26-
When I first wrote NEST back in 2010 I though it would be handy if the Get() operation returned only the document and if you want the full envelopped elasticsearch response you'd use `GetFull()`. This was rather confusing and on top of that Elasticsearch 1.0 now has it's own endpoint for getting JUST the document `_source`.
25+
### Renamed Get() to Source(), Removed GetFull()
26+
When Martijn first wrote NEST back in 2010, he thought it would be handy if the Get() operation returned only the document, and if you wanted the full enveloped Elasticsearch response, you'd use `GetFull()`. This was rather confusing and on top of that Elasticsearch 1.0 now has it's own endpoint for getting JUST the document `_source`.
2727
Similarily `GetMany()` is now called `SourceMany()`.
2828

2929
### Renamed QueryResponse to SearchResponse
3030

31-
The fact that `client.Search<T>()` returns a `QueryResponse<T>` and not a `SearchResponse<T>` never felt right to me, NEST 1.0 therefor renamed `QueryResponse<T>` to `SearchResponse<T>`
31+
The fact that `client.Search<T>()` returns a `QueryResponse<T>` and not a `SearchResponse<T>` never felt right, NEST 1.0 therefore renamed `QueryResponse<T>` to `SearchResponse<T>`
3232

33-
### Renamed RootObjectMappingDescriptor
33+
### Renamed PutTemplateRaw()
3434

35-
to `PutMappingDescriptor<T>`
35+
to `.PutTemplate` and can be used as follows:
3636

37-
### Removed IResponse.Error
37+
client.PutTemplate("template_name", s => s.Template("template_body"));
3838

39-
IResponse.Error.Exception no longer exists, it is inlined to IResponse.OriginalException. The Error property did not hold any information that was not available on IResponse.ConnectionStatus.
39+
### Other Renames
4040

41-
### Response Shortcuts
41+
#### `RootObjectMappingDescriptor` => `PutMappingDescriptor<T>`
42+
#### `BaseFilter` => `FilterContainer`
43+
#### `BaseQuery` => `QueryContainer`
44+
#### `SortDescriptor` => `SortFieldDescriptor`
4245

43-
Prior to 1.0 some calls directly returned a bool or value instead of the full envelopped Elasticsearch response.
46+
### Removed IResponse.Error
4447

45-
i.e `client.IndexExists("myIndexName")` used to return a bool but should now be called like this:
48+
IResponse.Error.Exception no longer exists, it is inlined to IResponse.OriginalException. The Error property did not hold any information that was not available on IResponse.ConnectionStatus.
4649

47-
client.IndexExists(i => i.Index("myIndexName")).Exists
50+
### Removed IndexMany()
4851

52+
`IndexMany` no longer has an overload that takes `SimpleBulkParameters`. You are now required to use `Bulk()` directly if you need more fine grained control.
4953

5054
### Removed MapFromAttributes()
5155

52-
Attributes are to limited in what they can specify so `[ElasticType()]` can now only specify the type name and the id property.
53-
All the other anotations have been removed from `[ElasticType()]`. The properties on `[ElasticProperty()]` still exists an can be applied like this:
56+
Attributes are too limited in what they can specify, so `[ElasticType()]` can now only specify the type name and the id property.
57+
All the other annotations have been removed from `[ElasticType()]`. The properties on `[ElasticProperty()]` still exists an can be applied like this:
5458

5559
var x = this._client.CreateIndex(index, s => s
5660
.AddMapping<ElasticsearchProject>(m => m
@@ -61,54 +65,65 @@ All the other anotations have been removed from `[ElasticType()]`. The propertie
6165

6266
Or in a separate put mapping call:
6367

64-
var response = this._client.Map<ElasticsearchProject>(m=>m.MapFromAttributes()......);
68+
var response = client.Map<ElasticsearchProject>(m => m.MapFromAttributes()......);
69+
70+
### Response Shortcuts
71+
72+
Prior to 1.0, some calls directly returned a bool or value instead of the full enveloped Elasticsearch response.
73+
74+
i.e `client.IndexExists("myIndexName")` used to return a bool but should now be called like this:
6575

66-
#### Alias Helpers
76+
client.IndexExists(i => i.Index("myIndexName")).Exists
77+
78+
### Alias Helpers
6779

68-
NEST 0.12.0 had some alias helpers, `SwapAlias()`, `GetIndicesPointingToAlias()` these have been removed in favor of just `Alias()` and `GetAliases()`. Especially the later could benefit from some extension methods that make the common use cases a bit easier to program with. These did not make the beta release.
80+
NEST 0.12.0 had some alias helpers, `SwapAlias()`, `GetIndicesPointingToAlias()`, etc. These have been removed in favor of just `Alias()` and `GetAliases()`.
6981

70-
#### Fields() vs SourceInclude()
82+
### Fields() vs SourceInclude()
7183

72-
Prior to Elasticsearch you could specify to return only certain fields and they would return like this:
84+
Prior to Elasticsearch 1.0, you could specify to return only certain fields and they would return like this:
7385

7486
...
7587
"fields" {
76-
"name" : "NEST"
77-
"followers.firstName: ["Martijn", "John", ...]
88+
"name": "NEST"
89+
"followers.firstName": ["Martijn", "John", ...]
7890
}
7991
...
8092

8193
In many case this could be mapped to the type of DTO you give search (i.e in `.Search<DTO>()`). Elasticsearch 1.0 now always returns the fields as arrays.
8294

8395
...
8496
"fields" {
85-
"name" : ["NEST"]
86-
"followers.firstName: ["Martijn", "John", ...]
97+
"name": ["NEST"]
98+
"followers.firstName": ["Martijn", "John", ...]
8799
}
88100
...
89101

90-
NEST 1.0 still supports this but is now a bit more verbose in how it supports mapping the fields back:
102+
NEST 1.0 still supports this, but is now a bit more verbose in how it supports mapping the fields back:
91103

92104

93105
var fields = _client.Get<DTO>(g => g
94106
.Id(4)
95107
.Fields(f => f.Name, f => f.Followers.First().FirstName)
96-
).Fields;
108+
).Fields;
109+
97110
var name = fields.FieldValue<DTO, string>(f => f.Name);
98-
var list = fields.FieldValue<DTO, string>(f=>f.Followers[0].FirstName);
111+
var list = fields.FieldValue<DTO, string>(f => f.Followers[0].FirstName);
99112

100113
`name` and `list` are of type `string[]`
101114

102115
### DocumentsWithMetaData
103116

104-
When you do a search with NEST 0.12 you'd get back a `QueryResponse<T>` with two ways to loop over your results. `.Documents` is an `IEnumerable<T>` and `.DocumentsWithMetaData` is and `IEnumerable<IHit<T>>` depending on your needs one of them might be easier to use.
117+
When you do a search with NEST 0.12, you'd get back a `QueryResponse<T>` with two ways to loop over your results. `.Documents` is an `IEnumerable<T>` and `.DocumentsWithMetaData` is and `IEnumerable<IHit<T>>` depending on your needs one of them might be easier to use.
105118

106119
Starting from NEST 1.0 `.DocumentsWithMetaData` is now called simply `.Hits`.
107120

108121
### int Properties
109122

110123
In quite a few places values that should have been `long` were mapped as `int` in NEST 0.12.0 which could be troublesome if you for instance have more than `2,147,483,647` matching documents. In my preperations for this release I helped port one of my former employees applications to Elasticsearch 1.1 and NEST 1.0 and found that this change had the most impact on the application and all of its models.
111124

125+
###
126+
112127
# Found another breaking change?
113128

114129
If you found another breaking chage please let us know on [the github issues](http://www.github.com/elasticsearch/elasticsearch-net/issues)

0 commit comments

Comments
 (0)