Graph Titan db没有在弹性搜索上创建文档,即使索引已启用配置选项

Graph Titan db没有在弹性搜索上创建文档,即使索引已启用配置选项,graph,titan,Graph,Titan,下面是我正在使用的配置选项 storage.backend=cassandra storage.hostname=192.168.56.121 storage.cassandra.keyspace=graphs cache.db-cache = false cache.db-cache-clean-wait = 20 index.search.backend=elasticsearch index.search.hostname=192.168.56.122 index.search.elas

下面是我正在使用的配置选项

storage.backend=cassandra
storage.hostname=192.168.56.121
storage.cassandra.keyspace=graphs
cache.db-cache = false
cache.db-cache-clean-wait = 20

index.search.backend=elasticsearch
index.search.hostname=192.168.56.122
index.search.elasticsearch.client-only=true
index.search.index-name=graphs

TitanGraph graph = GraphFactory.getInstance().getGraph();
TitanManagement mgmt = null;
try {
    mgmt = graph.openManagement();
    PropertyKey name = mgmt.getPropertyKey(Schema.NAME);
    if (name == null) {
        name = mgmt.makePropertyKey(Schema.NAME).dataType(String.class).make();

    }
    TitanGraphIndex graphIndex = mgmt.getGraphIndex("byName");

if (graphIndex == null) {
    IndexBuilder builder = mgmt.buildIndex("byName", Vertex.class).addKey(name);
    builder.buildCompositeIndex();
}

PropertyKey id = mgmt.getPropertyKey(Schema.ID);
if (id == null) {
    id = mgmt.makePropertyKey(Schema.ID).dataType(Long.class).make();
}

PropertyKey sourceType = mgmt.getPropertyKey(Schema.SOURCE_TYPE);
if (sourceType == null) {
    sourceType = mgmt.makePropertyKey(Schema.SOURCE_TYPE).dataType(String.class).make();
}

TitanGraphIndex uniqueIndex = mgmt.getGraphIndex("uniqueIndex");

if (uniqueIndex == null) {
    IndexBuilder builder = mgmt.buildIndex("uniqueIndex", Vertex.class).addKey(id).addKey(sourceType);
    builder.unique().buildCompositeIndex();
}

// Edges
EdgeLabel deps = mgmt.getEdgeLabel("deps");

if (deps == null) {
    deps = mgmt.makeEdgeLabel("deps").multiplicity(Multiplicity.SIMPLE).make();
}

RelationTypeIndex  depsIndex = mgmt.getRelationIndex(deps, "depsIndex");

if(depsIndex == null) {
    depsIndex = mgmt.buildEdgeIndex(deps, "depsIndex", Direction.BOTH, Order.decr);
}

mgmt.commit();


// Re index the existing data
if (reIndexData) {
    mgmt = graph.openManagement();
    mgmt.updateIndex(mgmt.getGraphIndex("uniqueIndex"), SchemaAction.REINDEX).get();
    mgmt.updateIndex(mgmt.getGraphIndex("byName"), SchemaAction.REINDEX).get();
    deps = mgmt.getEdgeLabel("deps");
    mgmt.updateIndex(mgmt.getRelationIndex(deps,"depsIndex"), SchemaAction.REINDEX).get();
        mgmt.commit();
    }

} catch (Throwable e) {
    log.error(e.getMessage(), e);
    if (mgmt != null) {
        mgmt.rollback();
    }
}
我已经创建了很多文档,一切都很好。但当我观察到弹性搜索中可用的文档数为0时

我想知道titan db是否真的在使用弹性搜索

你知道我在这里遗漏了什么吗?以及为什么不在弹性搜索中创建文档

我也尝试了下面的配置,但没有成功

storage.backend=cassandra
storage.hostname=192.168.56.121
storage.cassandra.keyspace=graphs
cache.db-cache = false
cache.db-cache-clean-wait = 20

index.graphs.backend=elasticsearch
index.graphs.hostname=192.168.56.122
index.graphs.elasticsearch.client-only=true
index.graphs.index-name=graphs

Titan将存储后端(cassandra/hbase)用于复合索引,将索引后端(Solr/Elastic Search)用于混合索引

混合索引通过先前添加的属性键的任意组合检索顶点或边。混合索引提供了比复合索引更大的灵活性,并支持超出相等范围的附加条件谓词。另一方面,对于大多数相等查询,混合索引比复合索引慢

与复合索引不同,混合索引需要配置索引后端,并使用该索引后端执行查找操作。Titan可以在一次安装中支持多个索引后端。每个索引后端必须通过Titan配置中的名称(称为索引后端名称)进行唯一标识

在模式中,只创建复合索引。这就是为什么ElasticSearch中没有数据

以下是如何创建混合索引的示例:

IndexBuilder builder = mgmt.buildIndex('byName', Vertex.class).addKey(name);
builder.buildMixedIndex("search");
mgmt.commit();


来源:Titan使用存储后端(cassandra/hbase)作为复合索引,使用索引后端(Solr/Elastic Search)作为混合索引

混合索引通过先前添加的属性键的任意组合检索顶点或边。混合索引提供了比复合索引更大的灵活性,并支持超出相等范围的附加条件谓词。另一方面,对于大多数相等查询,混合索引比复合索引慢

与复合索引不同,混合索引需要配置索引后端,并使用该索引后端执行查找操作。Titan可以在一次安装中支持多个索引后端。每个索引后端必须通过Titan配置中的名称(称为索引后端名称)进行唯一标识

在模式中,只创建复合索引。这就是为什么ElasticSearch中没有数据

以下是如何创建混合索引的示例:

IndexBuilder builder = mgmt.buildIndex('byName', Vertex.class).addKey(name);
builder.buildMixedIndex("search");
mgmt.commit();


来源:

非常感谢您的快速回复。很明显,我对混合索引也有疑问。我的数据检索主要从和顶点开始,它们将由ID、SOURCETYPE唯一标识。我结合这两个属性创建了uniquekey和composite key。这些是否足够,或者我是否需要进行任何更改以使其响应更快?如果您想按ID和源类型获取顶点,这就足够了。但如果只想通过sourceType获取顶点,则效率会很低。您必须根据查询创建索引。非常感谢您的快速响应。很明显,我对混合索引也有疑问。我的数据检索主要从和顶点开始,它们将由ID、SOURCETYPE唯一标识。我结合这两个属性创建了uniquekey和composite key。这些是否足够,或者我是否需要进行任何更改以使其响应更快?如果您想按ID和源类型获取顶点,这就足够了。但如果只想通过sourceType获取顶点,则效率会很低。您必须根据查询创建索引。