use of io.zulia.message.ZuliaServiceOuterClass.GetIndexSettingsResponse in project zuliasearch by zuliaio.
the class IndexController method get.
@Get
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public HttpResponse<?> get(@QueryValue(ZuliaConstants.INDEX) String index, @QueryValue(value = ZuliaConstants.PRETTY, defaultValue = "true") Boolean pretty) {
ZuliaIndexManager indexManager = ZuliaNodeProvider.getZuliaNode().getIndexManager();
try {
StringBuilder responseBuilder = new StringBuilder();
GetIndexSettingsResponse getIndexSettingsResponse = indexManager.getIndexSettings(ZuliaServiceOuterClass.GetIndexSettingsRequest.newBuilder().setIndexName(index).build());
responseBuilder.append("{");
responseBuilder.append("\"indexSettings\": ");
JsonFormat.Printer printer = JsonFormat.printer();
responseBuilder.append(printer.print(getIndexSettingsResponse.getIndexSettings()));
responseBuilder.append("}");
String docString = responseBuilder.toString();
if (pretty) {
docString = JsonWriter.formatJson(docString);
}
return HttpResponse.ok(docString).status(ZuliaConstants.SUCCESS);
} catch (Exception e) {
return HttpResponse.serverError("Failed to get index names: " + e.getMessage()).status(ZuliaConstants.INTERNAL_ERROR);
}
}
use of io.zulia.message.ZuliaServiceOuterClass.GetIndexSettingsResponse in project zuliasearch by zuliaio.
the class GetIndexConfig method execute.
@Override
public GetIndexConfigResult execute(ZuliaConnection zuliaConnection) {
ZuliaServiceBlockingStub service = zuliaConnection.getService();
GetIndexSettingsResponse getIndexConfigResponse = service.getIndexSettings(getRequest());
ClientIndexConfig indexConfig = new ClientIndexConfig();
indexConfig.configure(getIndexConfigResponse.getIndexSettings());
return new GetIndexConfigResult(indexConfig);
}
Aggregations