Package org.elasticsearch.common.xcontent

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


              }
            });
        contentBuilder.endObject();

        // cache mapping as string for easy debugging
        _mapping = contentBuilder.string();
      }
      return MappingSource.Builder.string(_mapping);
    } catch (IOException e) {
      throw new RuntimeException();
    }
View Full Code Here


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

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

            builder.field(cursor.value.type());
            builder.map(cursor.value.sourceAsMap());
        }
        builder.endObject();

        return builder.string();
    }

    /**
     * Get the IndexSettings as JSON String
     *
 
View Full Code Here

            builder.endObject();
        }

        builder.endObject();

        return builder.string();
    }

    /**
     * Execute an SQLRequest on a random client of the cluster like it would
     * be executed by an HTTP REST Request
View Full Code Here

            requestBuilder.includeTypesOnResponse(includeTypes);
            sqlResponse = requestBuilder.execute().actionGet();
        }
        sqlResponse.toXContent(builder, ToXContent.EMPTY_PARAMS);
        responseDuration = sqlResponse.duration();
        return builder.string();
    }

    protected String restSQLExecute(String source) throws IOException {
        return restSQLExecute(source, false);
    }
View Full Code Here

     */
    public static Map<String, Object> toMap(ToXContent toXContent) throws IOException {
        XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
        toXContent.toXContent(builder, ToXContent.EMPTY_PARAMS);
        return XContentFactory.xContent(XContentType.JSON).createParser(
                builder.string()).mapOrderedAndClose();
    }

    /**
     * Set up a second node and wait for green status
     */
 
View Full Code Here

                        .startObject("length").field("type", "long").endObject()
                        .startObject("chunkSize").field("type", "long").endObject()
                    .endObject()
               .endObject()
           .endObject();
        logger.info("GridFS Mapping: {}", mapping.string());
        return mapping;
    }

    /**
     * Get the latest timestamp for a given namespace.
View Full Code Here

  @Test
  public void putMappingWithNotAnalyzed() throws Exception {
        node.client().admin().indices().prepareCreate("es004index").execute().actionGet();

        XContentBuilder xbMapping = buildMapping();
        logger.info("Mapping is : {}", xbMapping.string());

        PutMappingResponse response = node.client().admin().indices()
            .preparePutMapping("es004index")
            .setType("type1")
            .setSource(xbMapping)
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

    @SuppressWarnings("unchecked")
    public ClusterUpdateSettingsRequest transientSettings(Map source) {
        try {
            XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
            builder.map(source);
            transientSettings(builder.string());
        } catch (IOException e) {
            throw new ElasticsearchGenerationException("Failed to generate [" + source + "]", e);
        }
        return this;
    }
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.