Package org.elasticsearch.common.xcontent

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


                .setFacets(facetQuery.bytes().array())
                .execute().actionGet();
        InternalDistinctDateHistogramFacet facet = (InternalDistinctDateHistogramFacet) response.getFacets().facet("distinct");
        XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON).startObject();
        facet.toXContent(builder, ToXContent.EMPTY_PARAMS).endObject();
        assertThat(builder.string(), equalTo(
                "{\"distinct\":{" +
                        "\"_type\":\"distinct_date_histogram\",\"entries\":[" +
                        "{\"time\":950400000,\"count\":1}" +
                        "]," +
                        "\"count\":1" +
View Full Code Here


                .setFacets(facetQuery.bytes().array())
                .execute().actionGet();
        facet = (InternalDistinctDateHistogramFacet) response.getFacets().facet("distinct");
        builder = XContentFactory.contentBuilder(XContentType.JSON).startObject();
        facet.toXContent(builder, ToXContent.EMPTY_PARAMS).endObject();
        assertThat(builder.string(), equalTo(
                "{\"distinct\":{" +
                        "\"_type\":\"distinct_date_histogram\",\"entries\":[" +
                        "{\"time\":950400000,\"count\":2}" +
                        "]," +
                        "\"count\":2" +
View Full Code Here

                .setFacets(facetQuery.bytes().array())
                .execute().actionGet();
        facet = (InternalDistinctDateHistogramFacet) response.getFacets().facet("distinct");
        builder = XContentFactory.contentBuilder(XContentType.JSON).startObject();
        facet.toXContent(builder, ToXContent.EMPTY_PARAMS).endObject();
        assertThat(builder.string(), equalTo(
                "{\"distinct\":{" +
                        "\"_type\":\"distinct_date_histogram\",\"entries\":[" +
                        "{\"time\":950400000,\"count\":2}," +
                        "{\"time\":1555200000,\"count\":3}" +
                        "]," +
View Full Code Here

                .setFacets(facetQuery.bytes().array())
                .execute().actionGet();
        InternalDistinctDateHistogramFacet facet = (InternalDistinctDateHistogramFacet) response.getFacets().facet("distinct");
        XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON).startObject();
        facet.toXContent(builder, ToXContent.EMPTY_PARAMS).endObject();
        assertThat(builder.string(), equalTo(
                "{\"distinct\":{" +
                        "\"_type\":\"distinct_date_histogram\",\"entries\":[" +
                        "{\"time\":950400000,\"count\":1}" +
                        "]," +
                        "\"count\":1" +
View Full Code Here

                .setFacets(facetQuery.bytes().array())
                .execute().actionGet();
        facet = (InternalDistinctDateHistogramFacet) response.getFacets().facet("distinct");
        builder = XContentFactory.contentBuilder(XContentType.JSON).startObject();
        facet.toXContent(builder, ToXContent.EMPTY_PARAMS).endObject();
        assertThat(builder.string(), equalTo(
                "{\"distinct\":{" +
                        "\"_type\":\"distinct_date_histogram\",\"entries\":[" +
                        "{\"time\":950400000,\"count\":2}" +
                        "]," +
                        "\"count\":2" +
View Full Code Here

                .setFacets(facetQuery.bytes().array())
                .execute().actionGet();
        facet = (InternalDistinctDateHistogramFacet) response.getFacets().facet("distinct");
        builder = XContentFactory.contentBuilder(XContentType.JSON).startObject();
        facet.toXContent(builder, ToXContent.EMPTY_PARAMS).endObject();
        assertThat(builder.string(), equalTo(
                "{\"distinct\":{" +
                        "\"_type\":\"distinct_date_histogram\",\"entries\":[" +
                        "{\"time\":950400000,\"count\":2}," +
                        "{\"time\":1555200000,\"count\":3}" +
                        "]," +
View Full Code Here

                                for (Object value : ((List) lastSeq)) {
                                    builder.value(value);
                                }
                                builder.endArray();
                                //builder.endObject();
                                lastSeqAsString = builder.string();
                            } catch (Exception e) {
                                logger.error("failed to convert last_seq to a json string", e);
                            }
                        } else {
                            lastSeqAsString = lastSeq.toString();
View Full Code Here

    final String expected = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,\"" +
        "type\":\"string\",\"index\":\"not_analyzed\",\"search_analyzer\":\"standard\"," +
        "\"index_analyzer\":\"standard\"}}}}";

    XContentBuilder xContentBuilder = MappingBuilder.buildMapping(SampleTransientEntity.class, "mapping", "id", null);
    assertThat(xContentBuilder.string(), is(expected));
  }

  @Test
  public void shouldUseValueFromAnnotationType() throws IOException {
    //Given
View Full Code Here

    //When
    XContentBuilder xContentBuilder = MappingBuilder.buildMapping(StockPrice.class, "mapping", "id", null);

    //Then
    assertThat(xContentBuilder.string(), is(expected));
  }

  @Test
  public void shouldAddStockPriceDocumentToIndex() throws IOException {
    //Given
View Full Code Here

  @Test
  public void shouldCreateMappingForSpecifiedParentType() throws IOException {
    final String expected = "{\"mapping\":{\"_parent\":{\"type\":\"parentType\"},\"properties\":{}}}";
    XContentBuilder xContentBuilder = MappingBuilder.buildMapping(MinimalEntity.class, "mapping", "id", "parentType");
    assertThat(xContentBuilder.string(), is(expected));
  }

  /*
   * DATAES-76
   */
 
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.