@@ -26,7 +26,7 @@ POST /_snapshot/sigterms/snapshot/_restore <3>
26
26
27
27
GET /mlmovies,mlratings/_recovery <4>
28
28
----
29
- // SENSE: 300_Aggregations/20_basic_example .json
29
+ // SENSE: 300_Aggregations/75_sigterms .json
30
30
<1> Register a new read-only URL repository pointing at the demo snapshot
31
31
<2> (Optional) Inspect the repository to learn details about available snapshots
32
32
<3> Begin the Restore process. This will download two indices into your cluster: `mlmovies`
@@ -70,7 +70,7 @@ GET mlmovies/_search <1>
70
70
},
71
71
....
72
72
----
73
- // SENSE: 300_Aggregations/20_basic_example .json
73
+ // SENSE: 300_Aggregations/75_sigterms .json
74
74
<1> Execute a search without a query, so that we can see a random sampling of docs.
75
75
76
76
Each document in `mlmovies` represents a single movie. The two important pieces
@@ -110,6 +110,7 @@ GET mlratings/_search
110
110
},
111
111
...
112
112
----
113
+ // SENSE: 300_Aggregations/75_sigterms.json
113
114
114
115
Here we can see the recommendations of individual users. Each document represents
115
116
a single user, denoted by the `user` ID field. The `movie` field holds a list
@@ -154,7 +155,8 @@ GET mlmovies/_search
154
155
},
155
156
...
156
157
----
157
- <1> The _Talladega Nights_ ID is `46970`.
158
+ // SENSE: 300_Aggregations/75_sigterms.json
159
+ <1> _Talladega Nights_ is ID `46970`.
158
160
159
161
Armed with the ID, we can now filter the ratings and ((("filtering", "in aggregations")))apply our `terms` aggregation
160
162
to find the most popular movies from people who also like _Talladega Nights_:
@@ -182,6 +184,7 @@ GET mlratings/_search?search_type=count <1>
182
184
}
183
185
}
184
186
----
187
+ // SENSE: 300_Aggregations/75_sigterms.json
185
188
<1> We execute our query on `mlratings` this time, and specify `search_type=count`
186
189
since we are interested only in the aggregation results.
187
190
<2> Apply a filter on the ID corresponding to _Talladega Nights_.
@@ -258,6 +261,7 @@ GET mlmovies/_search
258
261
}
259
262
}
260
263
----
264
+ // SENSE: 300_Aggregations/75_sigterms.json
261
265
262
266
And finally, we end up with the following list:
263
267
@@ -290,6 +294,7 @@ GET mlratings/_search?search_type=count
290
294
}
291
295
}
292
296
----
297
+ // SENSE: 300_Aggregations/75_sigterms.json
293
298
294
299
This returns a list that is very similar:
295
300
@@ -339,7 +344,8 @@ GET mlratings/_search?search_type=count
339
344
}
340
345
}
341
346
----
342
- <1> The setup is nearly identical: we just use `significant_terms` instead of
347
+ // SENSE: 300_Aggregations/75_sigterms.json
348
+ <1> The setup is nearly identical -- we just use `significant_terms` instead of
343
349
`terms`.
344
350
345
351
As you can see, the query is nearly the same. We filter for users who
0 commit comments