【问题标题】:Querying Titan ElasticSearch backend via Rexster通过 Rexster 查询 Titan ElasticSearch 后端
【发布时间】:2013-09-02 10:28:59
【问题描述】:

我有 Titan 0.3.2 在嵌入式模式下运行,并且能够通过 Gremlin shell (see previous question) 创建和查询 ElasticSearch 索引。我使用的是默认配置,它调用 ES 索引“搜索”。

这些搜索通过 Gremlin shell 返回正确的节点且没有错误:

g.query().has('my_label','abc').vertices()
g.query().has('my_label',CONTAINS,'abc').vertices()

但是,如果我尝试通过 RexPro 运行这些相同的 Gremlin 查询,Rexster 会针对上述第一个查询发回此错误:

java.util.concurrent.ExecutionException: 
javax.script.ScriptException: 
javax.script.ScriptException: 
java.lang.IllegalArgumentException: Index is unknown or not configured: search

这是第二个:

java.util.concurrent.ExecutionException: 
javax.script.ScriptException: 
javax.script.ScriptException: 
groovy.lang.MissingPropertyException: No such property: CONTAINS for class: Script3

同样,如果我尝试通过 REST API (GET) 查询索引键:

http://localhost:8182/graphs/graph/vertices?key=my_key&value=abc

我收到相同的错误响应:

{"message":"Index is unknown or not configured: search","error":"Index is unknown or not configured: search"}

最后,如果我尝试从一个干净的数据库开始并通过 rexpro 运行索引创建脚本:

g.makeType().name("my_label").dataType(String.class).indexed("search", Vertex.class).unique(Direction.OUT).makePropertyKey();

我看到同样的未知索引错误:

java.util.concurrent.ExecutionException: 
javax.script.ScriptException: 
javax.script.ScriptException: 
java.lang.IllegalArgumentException: Index is unknown or not configured: search

因此,Rexster 似乎需要一些关于索引后端的附加信息,可能在其配置文件中(我使用的是安装中包含的默认信息)。有谁熟悉这个问题?很高兴提供更多信息。

【问题讨论】:

    标签: gremlin titan rexster


    【解决方案1】:

    您可能会遇到各种情况,但主要是从 Titan 0.3.2 开始,Rexster 不会自动导入 Titan 类,因此您无法使用 CONTAINS 进行查询。这样做时需要指定完整的包名:

    com.thinkaurelius.titan.core.attribute.Text.CONTAINS
    

    我不能确定还有什么问题,但看起来弹性搜索索引配置不正确。这与 Titan 服务器的 Rexster 配置文件没有太大关系。它与传递给 titan.sh 的第二个参数有关,其中包含 Titan 配置信息。确保弹性搜索在此处显示的文件中正确配置(默认安装):https://github.com/thinkaurelius/titan/blob/master/config/titan-server-cassandra-es.properties

    【讨论】:

    • 斯蒂芬,再次感谢您的帮助。我希望其中一些问题对未来的 Titan 用户有所帮助。完全合格的CONTAINS 按照您的描述工作。但是,我的 Titan 配置文件与您链接到的文件完全匹配,当我通过 Gremlin shell 查询 Titan 时,ES 可以正常工作。如果问题不是 Rexster 特有的,为什么我在通过 RexPro 而不是通过 Gremlin shell 查询时看到Index is unknown or not configured: search
    • 我只是说这个问题与你提供给 titan.sh 的 rexster.xml 无关。这可能与您的索引或titan-server-cassandra-es.properties 文件的创建有关。通过在对titan.sh 的调用中指定titan-server-cassandra.properties 而不是titan-server-cassandra-es.properties,我能够重新创建该错误。未配置弹性搜索时,如果您尝试对图表使用类型生成器,似乎会出现该错误。
    • 你说得对,我的批处理脚本有问题。似乎 Titan 没有正确读取我传递给它的配置文件,但由于 cassandra-es.local 配置文件(在 g = TitanFactory.open("cassandra-es.local") 中提供),gremlin shell 能够计算出 elasticsearch 索引。再次感谢。
    猜你喜欢
    • 2015-02-15
    • 2015-09-23
    • 2014-11-27
    • 2016-09-07
    • 1970-01-01
    • 2013-11-03
    • 2017-07-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多