Package org.elasticsearch.common.xcontent

Examples of org.elasticsearch.common.xcontent.ToXContent$DelegatingMapParams


        sourceFieldMapper.close();
        sizeFieldMapper.close();
    }

    @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
        rootObjectMapper.toXContent(builder, params, new ToXContent() {
            @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
                if (indexAnalyzer != null && searchAnalyzer != null && indexAnalyzer.name().equals(searchAnalyzer.name()) && !indexAnalyzer.name().startsWith("_")) {
                    if (!indexAnalyzer.name().equals("default")) {
                        // same analyzers, output it once
                        builder.field("analyzer", indexAnalyzer.name());
View Full Code Here


    protected String unwrap(Object arg, boolean prettify) throws IOException {
        Object unwrappedArg = unwrapper.unwrap(arg, prettify);

        if (unwrappedArg instanceof  ToXContent) {
            ToXContent toXContent = (ToXContent) unwrappedArg;
            return toXContentAsString.asString(toXContent);
        }

        if (unwrappedArg != null) {
            return unwrappedArg.toString();
View Full Code Here

     */
    protected String javaToString(Object javaObject) {

        //We wanna show a string output whenever there's a ToXContent, which we can convert to json
        if (javaObject instanceof ToXContent) {
            ToXContent toXContent = (ToXContent) javaObject;
            try {
                return toXContentAsString.asString(toXContent);
            } catch (Exception e) {
                logger.warn("Error while trying to convert a {} to XContent", javaObject.getClass().getSimpleName(), e);
            }
View Full Code Here

        XContentBuilder contentBuilder = JsonXContent.contentBuilder();

        contentBuilder.startObject();
        mapperBuilder.build(new BuilderContext(null, new ContentPath())).toXContent(contentBuilder, null,
            new ToXContent() {

              @Override
              public XContentBuilder toXContent(XContentBuilder builder, Params params)
                  throws IOException {
                ImmutableMap<String, Object> meta = meta();
View Full Code Here

        XContentBuilder contentBuilder = JsonXContent.contentBuilder();

        contentBuilder.startObject();
        mapperBuilder.build(new BuilderContext(null, new ContentPath())).toXContent(contentBuilder,
            EMPTY_PARAMS, new ToXContent() {

              @Override
              public XContentBuilder toXContent(XContentBuilder builder, Params params)
                  throws IOException {
                ImmutableMap<String, Object> meta = meta();
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.xcontent.ToXContent$DelegatingMapParams

Copyright © 2018 www.massapicom. 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.