Skip to content

Commit ae21e76

Browse files
committed
Merge pull request #650 from vovikdrg/master
Update documentation
2 parents 4135628 + df613d6 commit ae21e76

File tree

4 files changed

+64
-16
lines changed

4 files changed

+64
-16
lines changed

new_docs/contents/nest/core/delete-by-query.markdown

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,30 @@ menuitem: delete-by-query
88

99
# Delete by Query
1010

11-
this.ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q.Term(f => f.Name, "elasticsearch.pm"));
11+
ConnectedClient.DeleteByQuery<object>(q => q.Query(rq => rq.Term(f => f.Name, "elasticsearch.pm")));
1212

1313
Elasticsearch allows you to delete over multiple types and indexes, so does NEST.
1414

15-
this.ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
16-
.Indices(new[] { "index1", "index2" })
17-
.Term(f => f.Name, "elasticsearch.pm")
15+
ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
16+
.Indices(new[] {"index1", "index2"})
17+
.Query(rq => rq.Term(f => f.Name, "elasticsearch.pm"))
1818
);
1919

2020
As always `*Async` variants are available too.
2121

2222
You can also delete by query over all the indices and types:
2323

24-
this.ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
24+
ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
2525
.AllIndices()
26-
.Term(f => f.Name, "elasticsearch.pm")
26+
.Query(rq => rq.Term(f => f.Name, "elasticsearch.pm"))
2727
);
2828

2929
The DeleteByQuery can be further controlled by passing a `DeleteByQueryParameters` object
3030

31-
this.ConnectedClient.DeleteByQuery<ElasticSearchProject>(
32-
q => q.Term(f => f.Name, "elasticsearch.pm")
33-
, new DeleteByQueryParameters { Consistency = Consistency.Quorum, Replication = Replication.Sync, Routing = "NEST" }
31+
ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
32+
.Query(rq => rq
33+
.Term(f => f.Name, "elasticsearch.pm"))
34+
.Routing("nest")
35+
.Replication(ReplicationOptions.Sync)
3436
);
37+

new_docs/contents/nest/core/delete.markdown

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,27 @@ The delete API allows to delete a typed JSON document from a specific index base
1313

1414
## By Id
1515

16-
this.ConnectedClient.DeleteById<ElasticSearchProject>(searchProject.Id);
17-
this.ConnectedClient.DeleteByIdAsync<ElasticSearchProject>(searchProject.Id, c => /* called later */);
16+
this.ConnectedClient.Delete<ElasticSearchProject>(searchProject.Id);
17+
this.ConnectedClient.DeleteAsync<ElasticSearchProject>(searchProject.Id);
18+
19+
## Delete with custom parameters
20+
21+
_client.Delete(request.Id, s => s
22+
.Type("users")
23+
.Index("myindex")
24+
);
1825

1926
## By object (T)
2027

2128
Id property is inferred (can be any value type (int, string, float ...))
2229

23-
this.ConnectedClient.Delete(searchProject);
24-
this.ConnectedClient.DeleteAsync(searchProject);
30+
this.ConnectedClient.Delete(searchProject);
31+
this.ConnectedClient.DeleteAsync(searchProject);
2532

2633
## By IEnumerable<T>
2734

28-
this.ConnectedClient.DeleteMany(searchProjects);
29-
this.ConnectedClient.DeleteManyAsync(searchProjects);
35+
this.ConnectedClient.DeleteMany(searchProjects);
36+
this.ConnectedClient.DeleteManyAsync(searchProjects);
3037

3138
## By IEnumerable<T> using bulkparameters
3239

new_docs/contents/nest/core/index.markdown

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ is sufficient. this will index post too `/[default index]/posts/12`. The typenam
2121

2222
If you need more control there are plenty of overloads, i.e:
2323

24-
client.Index(post, "index", "type", "id");
24+
_client.Index(post, i => i
25+
.Index(index)
26+
.Type(type)
27+
.Id(post.Id)
28+
);
2529

2630
## Asynchronous
2731

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
template: layout.jade
3+
title: Connecting
4+
menusection: search
5+
menuitem: aggregation
6+
---
7+
8+
9+
# Aggregations
10+
11+
Aggregations is new and more powerfull way to build facets. Using them its possible to build any kind of facets and grouped in way as needed.
12+
13+
## Simple query
14+
15+
var results = EClinet.Search<ElasticSearchObject>(s => s.QueryString("*")
16+
.Aggregations(a => a.Terms("GroupName", ta => ta.Field("Category")))
17+
);
18+
19+
then to read items
20+
21+
var termBucket = results.Aggs.Terms("GroupName").Items;
22+
23+
## Global
24+
25+
var results = EClinet.Search<ElasticSearchObject>(s => s.QueryString("*")
26+
.Aggregations(a => a.Global("Title", g=>g.Aggregations(ga => ga.Terms("GroupName", ta => ta.Field("Category"))))
27+
));
28+
29+
##Sub aggregation
30+
31+
var results = EClinet.Search<ElasticSearchObject>(s => s.QueryString("*")
32+
.Aggregations(a => a.Global("Title", g=>g.Aggregations(ga => ga.Terms("GroupName", ta => ta.Field("Category")
33+
.Aggregations(sa=>sa.Terms("Color", sat=>sat.Field("Color")))
34+
)))));

0 commit comments

Comments
 (0)