|
1 | 1 | package org.codelibs.elasticsearch.df.rest; |
2 | 2 |
|
| 3 | +import static java.util.Arrays.asList; |
| 4 | +import static java.util.Collections.unmodifiableList; |
3 | 5 | import static org.elasticsearch.rest.RestRequest.Method.GET; |
4 | 6 | import static org.elasticsearch.rest.RestRequest.Method.POST; |
5 | 7 | import static org.elasticsearch.rest.RestStatus.OK; |
|
8 | 10 | import java.io.File; |
9 | 11 | import java.io.FileInputStream; |
10 | 12 | import java.io.IOException; |
| 13 | +import java.util.List; |
11 | 14 |
|
12 | 15 | import org.apache.logging.log4j.LogManager; |
13 | 16 | import org.apache.logging.log4j.Logger; |
@@ -41,17 +44,21 @@ public class RestDataAction extends BaseRestHandler { |
41 | 44 |
|
42 | 45 | public RestDataAction(final Settings settings, |
43 | 46 | final RestController restController) { |
44 | | - restController.registerHandler(GET, "/_data", this); |
45 | | - restController.registerHandler(POST, "/_data", this); |
46 | | - restController.registerHandler(GET, "/{index}/_data", this); |
47 | | - restController.registerHandler(POST, "/{index}/_data", this); |
48 | | - |
49 | 47 | this.maxMemory = Runtime.getRuntime().maxMemory(); |
50 | 48 | this.defaultLimit = (long) (maxMemory |
51 | 49 | * (DEFAULT_LIMIT_PERCENTAGE / 100F)); |
52 | 50 | logger.info("Default limit: {}", defaultLimit); |
53 | 51 | } |
54 | 52 |
|
| 53 | + @Override |
| 54 | + public List<Route> routes() { |
| 55 | + return unmodifiableList(asList( |
| 56 | + new Route(GET, "/_data"), |
| 57 | + new Route(POST, "/_data"), |
| 58 | + new Route(GET, "/{index}/_data"), |
| 59 | + new Route(POST, "/{index}/_data"))); |
| 60 | + } |
| 61 | + |
55 | 62 | public RestChannelConsumer prepareRequest(final RestRequest request, |
56 | 63 | final NodeClient client) throws IOException { |
57 | 64 | SearchRequest searchRequest = new SearchRequest(); |
|
0 commit comments