Package org.elasticsearch.common.xcontent

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


        SpaceIndexingInfo lastIndexing = getLastSpaceIndexingInfo(spaceKey);
        if (lastIndexing != null) {
          builder.field("last_indexing");
          lastIndexing.buildDocument(builder, false, true);
        }
        builder.endObject();
      }
      builder.endArray();
    }
    builder.endObject();
    return builder.string();
View Full Code Here


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

  /**
   * @param spaceKey to get info for
View Full Code Here

      throws IOException {
    XContentBuilder builder = jsonBuilder().startObject();
    if (spaceKey != null)
      builder.field("spaceKey", spaceKey);
    builder.field("propertyName", propertyName).field(STORE_FIELD_VALUE, DateTimeUtils.formatISODateTime(datetime));
    builder.endObject();
    return builder;
  }

  @Override
  public Date readDatetimeValue(String spaceKey, String propertyName) throws IOException {
View Full Code Here

    expected.field("host", "test@localhost");
    expected.field("headerNameTwo", "headerValueTwo");
    expected.field("source", "flume_tail_src");
    expected.field("headerNameOne", "headerValueOne");
    expected.field("type", "sometype");
    expected.endObject();

    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
    assertEquals(new String(expected.bytes().array()), new String(actual
View Full Code Here

    expected.field("source", "flume_tail_src");
    expected.field("headerNameOne", "headerValueOne");
    expected.field("type", "sometype");
    expected.endObject();

    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
    assertEquals(new String(expected.bytes().array()), new String(actual
        .bytes().array()));
  }
View Full Code Here

    expected.field("host", "test@localhost");
    expected.field("headerNameTwo", "headerValueTwo");
    expected.field("source", "flume_tail_src");
    expected.field("headerNameOne", "headerValueOne");
    expected.field("type", "sometype");
    expected.endObject();

    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
    assertEquals(new String(expected.bytes().array()), new String(actual
View Full Code Here

    expected.field("source", "flume_tail_src");
    expected.field("headerNameOne", "headerValueOne");
    expected.field("type", "sometype");
    expected.endObject();

    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
    assertEquals(new String(expected.bytes().array()), new String(actual
        .bytes().array()));
  }
View Full Code Here

                sb.append(UUID.randomBase64UUID()).append(' ');
            }
            json.field("text_" + i, sb.toString());
        }

        json.endObject();

        String id = Long.toString(idCounter.incrementAndGet());
        client.client().prepareIndex("test", "type1", id)
                .setCreate(true)
                .setSource(json)
View Full Code Here

    private void indexDoc() throws Exception {
        XContentBuilder json = XContentFactory.jsonBuilder().startObject()
                .field("num", nextNumValue())
                .field("field", nextFieldValue());

        json.endObject();

        client.client().prepareIndex(nextIndex(), nextType())
                .setSource(json)
                .execute().actionGet();
        indexCounter.incrementAndGet();
View Full Code Here

                            sb.append(UUID.randomBase64UUID()).append(' ');
                        }
                        json.field("text_" + i, sb.toString());
                    }

                    json.endObject();

                    bulk.add(Requests.indexRequest("test" + (Math.abs(ThreadLocalRandom.current().nextInt()) % numberOfIndices)).type("type1").source(json));
                    indexCounter.incrementAndGet();
                }
                bulk.execute().actionGet();
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.