Package org.elasticsearch.common.xcontent

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


        "type\":\"string\",\"index\":\"not_analyzed\",\"search_analyzer\":\"standard\"," +
        "\"index_analyzer\":\"standard\"},\"createdDate\":{\"store\":false," +
        "\"type\":\"date\",\"index\":\"not_analyzed\"}}}}";

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

  /*
   * DATAES-76
   */
 
View Full Code Here


      "type\":\"date\",\"format\":\"basic_date\"}}}}";

  @Test
  public void testCorrectDateMappings() throws NoSuchFieldException, IntrospectionException, IOException {
    XContentBuilder xContentBuilder = MappingBuilder.buildMapping(SampleDateMappingEntity.class, "mapping", "id", null);
    Assert.assertEquals(EXPECTED_MAPPING, xContentBuilder.string());
  }
}
View Full Code Here

        XContentBuilder xContentBuilder = jsonBuilder().startObject();
        for (int i = 0; i < fielddata.length; i++) {
            xContentBuilder.field(fielddata[i], fielddata[++i]);
        }
        xContentBuilder.endObject();
        putDocument(dbName, id, xContentBuilder.string());
    }

    public static void putDocumentWithAttachments(String dbName, String id, List<String> doc, String... attachments) throws IOException {
        XContentBuilder xContentBuilder = jsonBuilder()
                .startObject()
View Full Code Here

                    .endObject();
        }

         xContentBuilder.endObject().endObject();

        CouchDBClient.putDocument(dbName, id, xContentBuilder.string());
    }

}
View Full Code Here

  private String xContentToString(ToXContent toXContent) {
    try {
      XContentBuilder builder = XContentFactory.jsonBuilder();
      toXContent.toXContent(builder, ToXContent.EMPTY_PARAMS);
      return builder.string();
    } catch (IOException e) {
      throw new IllegalStateException("Fail to convert request to string", e);
    }
  }
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

        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

          .field("type", "point")
          .field("coordinates", new double[] { longitude, latitude })
          .endObject();
      builder.field("tags", getTags());
      builder.endObject();
      return builder.string();
    } catch (IOException e) {
      throw new RuntimeException("Unable to serialize Node to Json", e);
    } finally {
      if (builder != null) builder.close();
    }
View Full Code Here

      if (shape.isClosed()) builder.endArray();
      builder.endArray();
      builder.endObject();
      builder.field("tags", getTags());
      builder.endObject();
      return builder.string();
    } catch (IOException e) {
      throw new RuntimeException("Unable to serialize Way to Json", e);
    } finally {
      if (builder != null) builder.close();
    }
View Full Code Here

                }
                if (content != null) {
                    json.field("data", content);
                }
                json.endObject();
                logger.info(json.string());
            } catch (IOException e) {
                logger.info("## Could not serialize to json: {} {} {} {} {} {} {} {} [{}]",
                        nowdt.toDateTimeISO().toString(),
                        method,
                        path,
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.