use of org.eclipse.vorto.repository.search.extractor.IIndexFieldExtractor in project vorto by eclipse.
the class ElasticSearchService method createIndexRequest.
private IndexRequest createIndexRequest(ModelInfo modelInfo, String tenantId) {
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put(TENANT_ID, tenantId);
for (IIndexFieldExtractor extractor : fieldExtractors) {
extractor.extractFields(modelInfo).forEach((key, value) -> {
jsonMap.put(key, value);
});
}
return new IndexRequest(VORTO_INDEX, DOC, modelInfo.getId().getPrettyFormat()).source(jsonMap);
}
use of org.eclipse.vorto.repository.search.extractor.IIndexFieldExtractor in project vorto by eclipse.
the class ElasticSearchService method createMappingForIndex.
private Map<String, Object> createMappingForIndex() {
Map<String, Object> properties = new HashMap<>();
properties.put(TENANT_ID, createPropertyWithType(FieldType.KEY));
for (IIndexFieldExtractor extractor : fieldExtractors) {
extractor.getFields().forEach((key, value) -> {
properties.put(key, createPropertyWithType(value));
});
}
Map<String, Object> mapping = new HashMap<>();
mapping.put("properties", properties);
return mapping;
}
Aggregations