@Test void testCreateMappingNested() throws IOException { FieldMapping nestedFieldMapping = FieldMapping.builder().setName("nestedField").setType(MappingType.BOOLEAN).build(); Mapping mapping = createMapping( FieldMapping.builder() .setName("field") .setType(MappingType.NESTED) .setNestedFieldMappings(singletonList(nestedFieldMapping)) .build()); XContentBuilder xContentBuilder = mappingContentBuilder.createMapping(mapping); assertEquals(JSON_NESTED, xContentBuilder.string()); }
XContentBuilder createMapping(Mapping mapping) { try (XContentBuilder contentBuilder = XContentFactory.contentBuilder(xContentType)) { createMapping(mapping, contentBuilder); return contentBuilder; } catch (IOException e) { throw new UncheckedIOException(e); } }
MappingContentBuilder { XContentBuilder createMapping(Mapping mapping) { try (XContentBuilder contentBuilder = XContentFactory.contentBuilder(xContentType)) { createMapping(mapping, contentBuilder); return contentBuilder; } catch (IOException e) { throw new UncheckedIOException(e); } } }
MappingContentBuilder { XContentBuilder createMapping(Mapping mapping) { try (XContentBuilder contentBuilder = XContentFactory.contentBuilder(xContentType)) { createMapping(mapping, contentBuilder); return contentBuilder; } catch (IOException e) { throw new UncheckedIOException(e); } } MappingContentBuilder();   MappingContentBuilder(XContentType xContentType); }
MappingContentBuilder { XContentBuilder createMapping(Mapping mapping) { try (XContentBuilder contentBuilder = XContentFactory.contentBuilder(xContentType)) { createMapping(mapping, contentBuilder); return contentBuilder; } catch (IOException e) { throw new UncheckedIOException(e); } } MappingContentBuilder();   MappingContentBuilder(XContentType xContentType);  }
MappingContentBuilder { XContentBuilder createMapping(Mapping mapping) { try (XContentBuilder contentBuilder = XContentFactory.contentBuilder(xContentType)) { createMapping(mapping, contentBuilder); return contentBuilder; } catch (IOException e) { throw new UncheckedIOException(e); } } MappingContentBuilder();   MappingContentBuilder(XContentType xContentType);  static final String KEYWORD_TYPE; static final String FIELDS; static final String TYPE; static final String INDEX; }