36
36
import org .elasticsearch .action .search .SearchScrollRequest ;
37
37
38
38
/**
39
+ * A client provides a one stop interface for performing actions/operations against the cluster.
40
+ *
41
+ * <p>All operations performed are asynchronous by nature. There are three flavors for each operation,
42
+ * the simplest returns an {@link ActionFuture}, another that also accepts an {@link ActionListener},
43
+ * and the last (prefixed with <tt>exec</tt>) which just accepts an {@link ActionListener} without returning
44
+ * an {@link ActionFuture}.
45
+ *
46
+ * <p>A client can either be retrieved from a {@link org.elasticsearch.server.Server} started, or connected remotely
47
+ * to one or more nodes using {@link org.elasticsearch.client.transport.TransportClient}.
48
+ *
39
49
* @author kimchy (Shay Banon)
50
+ * @see org.elasticsearch.server.Server#client()
51
+ * @see org.elasticsearch.client.transport.TransportClient
40
52
*/
41
53
public interface Client {
42
54
55
+ /**
56
+ * Closes the client.
57
+ */
43
58
void close ();
44
59
60
+ /**
61
+ * The admin client that can be used to perform administrative operations.
62
+ */
45
63
AdminClient admin ();
46
64
65
+ /**
66
+ * Index a JSON source associated with a given index and type.
67
+ *
68
+ * <p>The id is optional, if it is not provided, one will be generated automatically.
69
+ *
70
+ * @param request The index request
71
+ * @return The result future
72
+ * @see Requests#indexRequest(String)
73
+ */
47
74
ActionFuture <IndexResponse > index (IndexRequest request );
48
75
76
+ /**
77
+ * Index a JSON source associated with a given index and type.
78
+ *
79
+ * <p>The id is optional, if it is not provided, one will be generated automatically.
80
+ *
81
+ * @param request The index request
82
+ * @param listener A listener to be notified with a result
83
+ * @return The result future
84
+ * @see Requests#indexRequest(String)
85
+ */
49
86
ActionFuture <IndexResponse > index (IndexRequest request , ActionListener <IndexResponse > listener );
50
87
88
+ /**
89
+ * Index a JSON source associated with a given index and type.
90
+ *
91
+ * <p>The id is optional, if it is not provided, one will be generated automatically.
92
+ *
93
+ * @param request The index request
94
+ * @param listener A listener to be notified with a result
95
+ * @see Requests#indexRequest(String)
96
+ */
51
97
void execIndex (IndexRequest request , ActionListener <IndexResponse > listener );
52
98
99
+ /**
100
+ * Deletes a document from the index based on the index, type and id.
101
+ *
102
+ * @param request The delete request
103
+ * @return The result future
104
+ * @see Requests#deleteRequest(String)
105
+ */
53
106
ActionFuture <DeleteResponse > delete (DeleteRequest request );
54
107
108
+ /**
109
+ * Deletes a document from the index based on the index, type and id.
110
+ *
111
+ * @param request The delete request
112
+ * @param listener A listener to be notified with a result
113
+ * @return The result future
114
+ * @see Requests#deleteRequest(String)
115
+ */
55
116
ActionFuture <DeleteResponse > delete (DeleteRequest request , ActionListener <DeleteResponse > listener );
56
117
118
+ /**
119
+ * Deletes a document from the index based on the index, type and id.
120
+ *
121
+ * @param request The delete request
122
+ * @param listener A listener to be notified with a result
123
+ * @see Requests#deleteRequest(String)
124
+ */
57
125
void execDelete (DeleteRequest request , ActionListener <DeleteResponse > listener );
58
126
127
+ /**
128
+ * Deletes all documents from one or more indices based on a query.
129
+ *
130
+ * @param request The delete by query request
131
+ * @return The result future
132
+ * @see Requests#deleteByQueryRequest(String...)
133
+ */
59
134
ActionFuture <DeleteByQueryResponse > deleteByQuery (DeleteByQueryRequest request );
60
135
136
+ /**
137
+ * Deletes all documents from one or more indices based on a query.
138
+ *
139
+ * @param request The delete by query request
140
+ * @param listener A listener to be notified with a result
141
+ * @return The result future
142
+ * @see Requests#deleteByQueryRequest(String...)
143
+ */
61
144
ActionFuture <DeleteByQueryResponse > deleteByQuery (DeleteByQueryRequest request , ActionListener <DeleteByQueryResponse > listener );
62
145
146
+ /**
147
+ * Deletes all documents from one or more indices based on a query.
148
+ *
149
+ * @param request The delete by query request
150
+ * @param listener A listener to be notified with a result
151
+ * @see Requests#deleteByQueryRequest(String...)
152
+ */
63
153
void execDeleteByQuery (DeleteByQueryRequest request , ActionListener <DeleteByQueryResponse > listener );
64
154
155
+ /**
156
+ * Gets the JSON source that was indexed from an index with a type and id.
157
+ *
158
+ * @param request The get request
159
+ * @return The result future
160
+ * @see Requests#getRequest(String)
161
+ */
65
162
ActionFuture <GetResponse > get (GetRequest request );
66
163
164
+ /**
165
+ * Gets the JSON source that was indexed from an index with a type and id.
166
+ *
167
+ * @param request The get request
168
+ * @param listener A listener to be notified with a result
169
+ * @return The result future
170
+ * @see Requests#getRequest(String)
171
+ */
67
172
ActionFuture <GetResponse > get (GetRequest request , ActionListener <GetResponse > listener );
68
173
174
+ /**
175
+ * Gets the JSON source that was indexed from an index with a type and id.
176
+ *
177
+ * @param request The get request
178
+ * @param listener A listener to be notified with a result
179
+ * @see Requests#getRequest(String)
180
+ */
69
181
void execGet (GetRequest request , ActionListener <GetResponse > listener );
70
182
183
+ /**
184
+ * A count of all the documents matching a specific query.
185
+ *
186
+ * @param request The count request
187
+ * @return The result future
188
+ * @see Requests#countRequest(String...)
189
+ */
71
190
ActionFuture <CountResponse > count (CountRequest request );
72
191
192
+ /**
193
+ * A count of all the documents matching a specific query.
194
+ *
195
+ * @param request The count request
196
+ * @param listener A listener to be notified of the result
197
+ * @return The result future
198
+ * @see Requests#countRequest(String...)
199
+ */
73
200
ActionFuture <CountResponse > count (CountRequest request , ActionListener <CountResponse > listener );
74
201
202
+ /**
203
+ * A count of all the documents matching a specific query.
204
+ *
205
+ * @param request The count request
206
+ * @param listener A listener to be notified of the result
207
+ * @see Requests#countRequest(String...)
208
+ */
75
209
void execCount (CountRequest request , ActionListener <CountResponse > listener );
76
210
211
+ /**
212
+ * Search across one or more indices and one or more types with a query.
213
+ *
214
+ * @param request The search request
215
+ * @return The result future
216
+ * @see Requests#searchRequest(String...)
217
+ */
77
218
ActionFuture <SearchResponse > search (SearchRequest request );
78
219
220
+ /**
221
+ * Search across one or more indices and one or more types with a query.
222
+ *
223
+ * @param request The search request
224
+ * @param listener A listener to be notified of the result
225
+ * @return The result future
226
+ * @see Requests#searchRequest(String...)
227
+ */
79
228
ActionFuture <SearchResponse > search (SearchRequest request , ActionListener <SearchResponse > listener );
80
229
230
+ /**
231
+ * Search across one or more indices and one or more types with a query.
232
+ *
233
+ * @param request The search request
234
+ * @param listener A listener to be notified of the result
235
+ * @see Requests#searchRequest(String...)
236
+ */
81
237
void execSearch (SearchRequest request , ActionListener <SearchResponse > listener );
82
238
239
+ /**
240
+ * A search scroll request to continue searching a previous scrollable search request.
241
+ *
242
+ * @param request The search scroll request
243
+ * @return The result future
244
+ * @see Requests#searchScrollRequest(String)
245
+ */
83
246
ActionFuture <SearchResponse > searchScroll (SearchScrollRequest request );
84
247
248
+ /**
249
+ * A search scroll request to continue searching a previous scrollable search request.
250
+ *
251
+ * @param request The search scroll request
252
+ * @param listener A listener to be notified of the result
253
+ * @return The result future
254
+ * @see Requests#searchScrollRequest(String)
255
+ */
85
256
ActionFuture <SearchResponse > searchScroll (SearchScrollRequest request , ActionListener <SearchResponse > listener );
86
257
258
+ /**
259
+ * A search scroll request to continue searching a previous scrollable search request.
260
+ *
261
+ * @param request The search scroll request
262
+ * @param listener A listener to be notified of the result
263
+ * @see Requests#searchScrollRequest(String)
264
+ */
87
265
void execSearchScroll (SearchScrollRequest request , ActionListener <SearchResponse > listener );
88
266
}
0 commit comments