use of org.webpieces.elasticsearch.mapping.ObjectMapping in project webpieces by deanhiller.
the class TestElasticStuff method testMappings.
@Test
public void testMappings() throws InterruptedException, ExecutionException, IOException, TimeoutException {
TextMapping name = new TextMapping();
Map<String, PropertyMapping> dataSourceProps = new HashMap<String, PropertyMapping>();
dataSourceProps.put("name", name);
ObjectMapping dataSource = new ObjectMapping();
dataSource.setProperties(dataSourceProps);
Map<String, PropertyMapping> properties = new HashMap<String, PropertyMapping>();
properties.put("dataSource", dataSource);
properties.put("dbCreatedAt", new DateMapping());
properties.put("dbUpdatedAt", new DateMapping());
Mappings mappings = new Mappings();
mappings.setProperties(properties);
ElasticIndex index = new ElasticIndex();
index.setMappings(mappings);
String s = mapper.writeValueAsString(index);
System.out.println("json=" + s);
}
Aggregations