Search in sources :

Example 1 with DocumentSchema

use of org.unipop.elastic.document.DocumentSchema in project unipop by unipop-graph.

the class ElasticSourceProvider method init.

@Override
public Set<UniQueryController> init(UniGraph graph, JSONObject configuration, TraversalFilter traversalFilter) throws Exception {
    this.graph = graph;
    List<String> addresses = ConversionUtils.toStringList(configuration, "addresses");
    this.client = new ElasticClient(addresses);
    Set<DocumentSchema> schemas = new HashSet<>();
    for (JSONObject json : getList(configuration, "vertices")) {
        schemas.add(createVertexSchema(json));
    }
    for (JSONObject json : getList(configuration, "edges")) {
        schemas.add(createEdgeSchema(json));
    }
    DocumentController documentController = new DocumentController(schemas, client, graph, traversalFilter);
    return Sets.newHashSet(documentController);
}
Also used : JSONObject(org.json.JSONObject) ElasticClient(org.unipop.elastic.common.ElasticClient) DocumentController(org.unipop.elastic.document.DocumentController) DocumentSchema(org.unipop.elastic.document.DocumentSchema) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 JSONObject (org.json.JSONObject)1 ElasticClient (org.unipop.elastic.common.ElasticClient)1 DocumentController (org.unipop.elastic.document.DocumentController)1 DocumentSchema (org.unipop.elastic.document.DocumentSchema)1