-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathDataService.java
56 lines (46 loc) · 1.51 KB
/
DataService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package itx.elastic.demo;
import itx.elastic.demo.dto.EventData;
import itx.elastic.demo.dto.EventDataInfo;
import itx.elastic.demo.dto.EventId;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import java.io.IOException;
import java.util.Collection;
import java.util.Optional;
public interface DataService {
/**
* Save document data using index provided within {@link EventData} object.
* Make sure that index of the document is unique. (client generated index)
* @param eventData
* @return
* @throws IOException
*/
boolean saveData(EventData eventData) throws IOException;
/**
* Save document data using index generated by server.
* @param eventDataInfo
* @return
* @throws IOException
*/
Optional<EventId> saveData(EventDataInfo eventDataInfo) throws IOException;
/**
* Get document by it's id.
* @param id
* @return
* @throws IOException
*/
Optional<EventData> getDataById(EventId id) throws IOException;
/**
* Get all documents synchronously. (not suitable for big indices)
* @return
* @throws IOException
*/
Collection<EventData> getDataAll() throws IOException;
/**
* Delete document by given Id.
* @param id
* @return
* @throws IOException
*/
boolean deleteData(EventId id) throws IOException;
Collection<EventData> getData(SearchSourceBuilder searchSourceBuilder) throws IOException;
}