Search in sources :

Example 1 with ElasticClient

use of org.unipop.elastic.common.ElasticClient 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)

Example 2 with ElasticClient

use of org.unipop.elastic.common.ElasticClient in project unipop by unipop-graph.

the class RestGraphProvider method loadGraphData.

@Override
public void loadGraphData(Graph graph, LoadGraphWith loadGraphWith, Class testClass, String testName) {
    ElasticClient client = new ElasticClient(Collections.singletonList("http://localhost:9200"));
    client.validateIndex("edge");
    client.validateIndex("vertex");
    super.loadGraphData(graph, loadGraphWith, testClass, testName);
}
Also used : ElasticClient(org.unipop.elastic.common.ElasticClient)

Aggregations

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