Package org.elasticsearch.common.xcontent

Examples of org.elasticsearch.common.xcontent.XContentBuilder.string()


            //Let's just try again, hopefully it'll work
            builder.startObject();
            toXContent.toXContent(builder, ToXContent.EMPTY_PARAMS);
            builder.endObject();
        }
        return builder.string();
    }
}
View Full Code Here


        builder.endObject();
      }
      builder.endArray();
    }
    builder.endObject();
    return builder.string();
  }

  /**
   * @param projectKey to get info for
   * @return project indexing info or null if not found.
View Full Code Here

                                .setSource(json)
                );
                if (LOG.isDebugEnabled()) {
                    try {
                        LOG.debug("Indexing " + entry.getKey().getClazz() + "(index:" + scm.getIndexName() + ",type:" + scm.getElasticTypeName() +
                                ") of id " + entry.getKey().getId() + " and source " + json.string());
                    } catch (IOException e) {
                    }
                }
            } finally {
                if (null != persistenceInterceptor) {
View Full Code Here

            XContentBuilder builder = XContentFactory.jsonBuilder();
            builder.startObject();
            toXContent.toXContent(builder, SearchResponse.EMPTY_PARAMS);
            builder.endObject();

            JsonObject response = new JsonObject(builder.string());
            sendOK(message, response);

        } catch (IOException e) {
            sendError(message, "Error reading search response: " + e.getMessage(), e);
        }
View Full Code Here

        try {
            XContentBuilder builder = XContentFactory.jsonBuilder().prettyPrint();
            builder.startObject();
            toXContent(builder, EMPTY_PARAMS);
            builder.endObject();
            return builder.string();
        } catch (IOException e) {
            return "{ \"error\" : \"" + e.getMessage() + "\"}";
        }
    }
}
View Full Code Here

                .startObject().field("success", true).field("type", type);
        if (builder != null) {
            responseBuilder.rawField("data", builder.bytes());
        }
        responseBuilder.endObject();
        this.response = new TextWebSocketFrame(responseBuilder.string());
    }

    public NettyInteractiveResponse(String type, Map<String, Object> map) throws IOException {
        this.type = type;
        XContentBuilder responseBuilder = jsonBuilder();
View Full Code Here

    public NettyInteractiveResponse(String type, Map<String, Object> map) throws IOException {
        this.type = type;
        XContentBuilder responseBuilder = jsonBuilder();
        responseBuilder.startObject().field("success", true).field("type", type).field("data", map).endObject();
        this.response = new TextWebSocketFrame(responseBuilder.string());
    }

    public NettyInteractiveResponse(String type, Throwable t) {
        this.type = type;
        this.response = new TextWebSocketFrame("{\"success\":false,\"type\":\"" + type + "\",\"error\":\"" + t.getMessage() + "\"");
View Full Code Here

    }

    public static String toString(ToXContent content) throws IOException {
        XContentBuilder json = jsonBuilder();
        content.toXContent(json, null); //ToXContent.EMPTY_PARAMS       
        return json.string();
    }
}
View Full Code Here

        try {
            XContentBuilder builder = XContentFactory.jsonBuilder().prettyPrint();
            builder.startObject();
            toXContent(builder, EMPTY_PARAMS);
            builder.endObject();
            return builder.string();
        } catch (IOException e) {
            return "{ \"error\" : \"" + e.getMessage() + "\"}";
        }
    }
}
View Full Code Here

                .startObject("index")
                    .field("flush_interval", "500ms")
                .endObject()
                .endObject();

        logger.info("  --> river meant to be created: {}", river.string());

        return river;
    }

    private void startRiver(final String riverName, final String lastupdate_id, XContentBuilder river) throws InterruptedException {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.