带有 Elasticsearch 索引的 JanusGraph 不工作
JanusGraph with Elasticsearch index is not working
我在 JanusGraph 中添加了混合索引以支持使用 Elasticsearch 进行全文搜索。
我有像这样的混合索引:
myindex = mgmt.buildIndex("myesindex", Vertex.class)
.addKey("name", Mapping.TEXTSTRING.asParameter())
.addKey("sabindex", Mapping.TEXTSTRING.asParameter())
.buildMixedIndex("search");
我能够将数据加载到 Elasticsearch 引擎中。
我也能够成功执行查询。
我遇到的问题是当我点击查询时:
g.V().has('code','abc').valueMap()
==>{str=[some text], code=[abc], sab=[sab], sabindex=[sabindex], name=[[some tex]]}
我成功获得了结果,但是当我尝试使用名称和代码进行搜索时:
g.V().has('name', textContains('some text')).has('code','abc').valueMap()
代码字段也被索引(复合)
当时我没有得到任何结果。尽管数据存在于图形和 Elasticsearch 中。
另一种情况是使用不同名称和代码的相同查询成功运行。我也多次重建图表,但没有得到积极的结果。
第一个查询显示值为name=[[some tex]]
。它缺少 text
中的最后一个 t
,因此这解释了为什么查询在 some text
.
上不匹配
如果您改为执行 textContains('some tex')
,您会得到与第一个查询相同的结果。使用 profile()
步骤将显示使用了 myindex
。
查看此 gist 重建场景。
我在 JanusGraph 中添加了混合索引以支持使用 Elasticsearch 进行全文搜索。
我有像这样的混合索引:
myindex = mgmt.buildIndex("myesindex", Vertex.class)
.addKey("name", Mapping.TEXTSTRING.asParameter())
.addKey("sabindex", Mapping.TEXTSTRING.asParameter())
.buildMixedIndex("search");
我能够将数据加载到 Elasticsearch 引擎中。 我也能够成功执行查询。
我遇到的问题是当我点击查询时:
g.V().has('code','abc').valueMap()
==>{str=[some text], code=[abc], sab=[sab], sabindex=[sabindex], name=[[some tex]]}
我成功获得了结果,但是当我尝试使用名称和代码进行搜索时:
g.V().has('name', textContains('some text')).has('code','abc').valueMap()
代码字段也被索引(复合)
当时我没有得到任何结果。尽管数据存在于图形和 Elasticsearch 中。
另一种情况是使用不同名称和代码的相同查询成功运行。我也多次重建图表,但没有得到积极的结果。
第一个查询显示值为name=[[some tex]]
。它缺少 text
中的最后一个 t
,因此这解释了为什么查询在 some text
.
如果您改为执行 textContains('some tex')
,您会得到与第一个查询相同的结果。使用 profile()
步骤将显示使用了 myindex
。
查看此 gist 重建场景。