You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/contents/breaking-changes.md
+42-27Lines changed: 42 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,42 +15,46 @@ Elasticsearch 1.0 comes with it's own set of breaking changes which [are all doc
15
15
16
16
### Strong Named Packages
17
17
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.
19
19
20
20
21
21
### IElasticClient
22
22
23
23
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.
24
24
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`.
27
27
Similarily `GetMany()` is now called `SourceMany()`.
28
28
29
29
### Renamed QueryResponse to SearchResponse
30
30
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>`
32
32
33
-
### Renamed RootObjectMappingDescriptor
33
+
### Renamed PutTemplateRaw()
34
34
35
-
to `PutMappingDescriptor<T>`
35
+
to `.PutTemplate` and can be used as follows:
36
36
37
-
### Removed IResponse.Error
37
+
client.PutTemplate("template_name", s => s.Template("template_body"));
38
38
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.
Prior to 1.0 some calls directly returned a bool or value instead of the full envelopped Elasticsearch response.
46
+
### Removed IResponse.Error
44
47
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.
`IndexMany` no longer has an overload that takes `SimpleBulkParameters`. You are now required to use `Bulk()` directly if you need more fine grained control.
49
53
50
54
### Removed MapFromAttributes()
51
55
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:
54
58
55
59
var x = this._client.CreateIndex(index, s => s
56
60
.AddMapping<ElasticsearchProject>(m => m
@@ -61,54 +65,65 @@ All the other anotations have been removed from `[ElasticType()]`. The propertie
61
65
62
66
Or in a separate put mapping call:
63
67
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:
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()`.
69
81
70
-
####Fields() vs SourceInclude()
82
+
### Fields() vs SourceInclude()
71
83
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:
73
85
74
86
...
75
87
"fields" {
76
-
"name": "NEST"
77
-
"followers.firstName: ["Martijn", "John", ...]
88
+
"name": "NEST"
89
+
"followers.firstName": ["Martijn", "John", ...]
78
90
}
79
91
...
80
92
81
93
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.
82
94
83
95
...
84
96
"fields" {
85
-
"name": ["NEST"]
86
-
"followers.firstName: ["Martijn", "John", ...]
97
+
"name": ["NEST"]
98
+
"followers.firstName": ["Martijn", "John", ...]
87
99
}
88
100
...
89
101
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:
91
103
92
104
93
105
var fields = _client.Get<DTO>(g => g
94
106
.Id(4)
95
107
.Fields(f => f.Name, f => f.Followers.First().FirstName)
96
-
).Fields;
108
+
).Fields;
109
+
97
110
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);
99
112
100
113
`name` and `list` are of type `string[]`
101
114
102
115
### DocumentsWithMetaData
103
116
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.
105
118
106
119
Starting from NEST 1.0 `.DocumentsWithMetaData` is now called simply `.Hits`.
107
120
108
121
### int Properties
109
122
110
123
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.
111
124
125
+
###
126
+
112
127
# Found another breaking change?
113
128
114
129
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