2017-04-18 170 views
1

我将把我的Neo4j应用程序与Elasticsearch集成。我要从GraphAware下面试试下面的Neo4j插件https://github.com/graphaware/neo4j-to-elasticsearchNeo4j 3.1.3与Elasticsearch集成

请问是否支持Neo4j 3.1.3版本?另外,ES应该使用哪个版本?例如,它是否支持ES 5.3.0?

现在我已经在本地安装了Elasticsearch 5.3.0。我还添加了2个罐子:

graphaware-neo4j-to-elasticsearch-3.1.3.45.7.jar 
graphaware-server-community-all-3.1.3.46.jar 

到我的Neo4j CE 3.1.3\plugins\文件夹。

另外,我还增加了以下配置(如这里descrbed https://github.com/neo4j-contrib/neo4j-elasticsearch#example)线到我的数据库配置(Neo4j Community Edition\neo4j.conf):

elasticsearch.host_name=http://localhost:9200 
elasticsearch.index_spec=decisions:Decision(name,description) 

但是当我通过弹簧数据Neo4j的项目没有插入数据发生。 。Elasticsearch索引仍然是空的。

我在做什么错误,以及如何使它工作?

修订

我做了这方面的一些进展:

这是我Neo4j.conf:

dbms.unmanaged_extension_classes=com.graphaware.server=/graphaware 

com.graphaware.runtime.enabled=true 

com.graphaware.module.ES.2=com.graphaware.module.es.ElasticSearchModuleBootstrapper 

com.graphaware.module.UIDM.uuidProperty=ID() 
com.graphaware.module.ES.node=hasLabel('Decision') 
com.graphaware.module.ES.relationship=(false) 

com.graphaware.module.ES.uri=localhost 
com.graphaware.module.ES.port=9200 

com.graphaware.module.ES.index=neo4j-index 

在我的应用我有一个实体:DecisionDecision是一个复杂的类型有很大父层次:

Decision extends Commentable extends Votable extends Flaggable ... and so on.

现在我加入〜60个决策节点到我的Neo4j数据库,但我无法看到所有的人都在ES。我只能在层次结构中看到每个父类都有重复的第一个。

这是什么什么,我现在有:

$ curl -XGET 'http://127.0.0.1:9200/neo4j-index-node/_search?pretty=true&q=*:*' 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0  0 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0{ 
    "took" : 1, 
    "timed_out" : false, 
    "_shards" : { 
    "total" : 5, 
    "successful" : 5, 
    "failed" : 0 
    }, 
    "hits" : { 
    "total" : 8, 
    "max_score" : 1.0, 
    "hits" : [ { 
     "_index" : "neo4j-index-node", 
     "_type" : "Decision", 
     "_id" : "null", 
     "_score" : 1.0, 
     "_source" : { 
     "avgVotesWeight" : 0.0, 
     "updateDate" : "2017-04-19T09:17:36.883Z", 
     "nameSlug" : "antivirus-software-for-windows", 
     "lowerName" : "antivirus software for windows", 
     "description" : "This is a non-exhaustive list of notable antivirus and Internet Security software, in the form of comparison tables, according to their platform (e.g. desktop and server, mobile, etc.)", 
     "totalDislikes" : 0, 
     "totalChildDecisions" : 59, 
     "totalCriteria" : 19, 
     "multiVotesAllowed" : false, 
     "totalCharacteristics" : 8, 
     "totalComments" : 0, 
     "totalFlags" : 0, 
     "likeSum" : 0.0, 
     "totalVotes" : 665, 
     "name" : "Antivirus software for Windows", 
     "totalLikes" : 0, 
     "createDate" : "2017-04-19T09:17:20.347Z" 
     } 
    }, { 
     "_index" : "neo4j-index-node", 
     "_type" : "Authorable", 
     "_id" : "null", 
     "_score" : 1.0, 
     "_source" : { 
     "avgVotesWeight" : 0.0, 
     "updateDate" : "2017-04-19T09:17:36.883Z", 
     "nameSlug" : "antivirus-software-for-windows", 
     "lowerName" : "antivirus software for windows", 
     "description" : "This is a non-exhaustive list of notable antivirus and Internet Security software, in the form of comparison tables, according to their platform (e.g. desktop and server, mobile, etc.)", 
     "totalDislikes" : 0, 
     "totalChildDecisions" : 59, 
     "totalCriteria" : 19, 
     "multiVotesAllowed" : false, 
     "totalCharacteristics" : 8, 
     "totalComments" : 0, 
     "totalFlags" : 0, 
     "likeSum" : 0.0, 
     "totalVotes" : 665, 
     "name" : "Antivirus software for Windows", 
     "totalLikes" : 0, 
     "createDate" : "2017-04-19T09:17:20.347Z" 
     } 
    }, { 
     "_index" : "neo4j-index-node", 
     "_type" : "Subscribable", 
     "_id" : "null", 
     "_score" : 1.0, 
     "_source" : { 
     "avgVotesWeight" : 0.0, 
     "updateDate" : "2017-04-19T09:17:36.883Z", 
     "nameSlug" : "antivirus-software-for-windows", 
     "lowerName" : "antivirus software for windows", 
     "description" : "This is a non-exhaustive list of notable antivirus and Internet Security software, in the form of comparison tables, according to their platform (e.g. desktop and server, mobile, etc.)", 
     "totalDislikes" : 0, 
     "totalChildDecisions" : 59, 
     "totalCriteria" : 19, 
     "multiVotesAllowed" : false, 
     "totalCharacteristics" : 8, 
     "totalComments" : 0, 
     "totalFlags" : 0, 
     "likeSum" : 0.0, 
     "totalVotes" : 665, 
     "name" : "Antivirus software for Windows", 
     "totalLikes" : 0, 
     "createDate" : "2017-04-19T09:17:20.347Z" 
     } 
    }, { 
     "_index" : "neo4j-index-node", 
     "_type" : "BaseEntity", 
     "_id" : "null", 
     "_score" : 1.0, 
     "_source" : { 
     "avgVotesWeight" : 0.0, 
     "updateDate" : "2017-04-19T09:17:36.883Z", 
     "nameSlug" : "antivirus-software-for-windows", 
     "lowerName" : "antivirus software for windows", 
     "description" : "This is a non-exhaustive list of notable antivirus and Internet Security software, in the form of comparison tables, according to their platform (e.g. desktop and server, mobile, etc.)", 
     "totalDislikes" : 0, 
     "totalChildDecisions" : 59, 
     "totalCriteria" : 19, 
     "multiVotesAllowed" : false, 
     "totalCharacteristics" : 8, 
     "totalComments" : 0, 
     "totalFlags" : 0, 
     "likeSum" : 0.0, 
     "totalVotes" : 665, 
     "name" : "Antivirus software for Windows", 
     "totalLikes" : 0, 
     "createDate" : "2017-04-19T09:17:20.347Z" 
     } 
    }, { 
     "_index" : "neo4j-index-node", 
     "_type" : "Votable", 
100 7842 100 7842 0  0 7842  0 0:00:01 --:--:-- 0:00:01 7658kl", 
     "_score" : 1.0, 
     "_source" : { 
     "avgVotesWeight" : 0.0, 
     "updateDate" : "2017-04-19T09:17:36.883Z", 
     "nameSlug" : "antivirus-software-for-windows", 
     "lowerName" : "antivirus software for windows", 
     "description" : "This is a non-exhaustive list of notable antivirus and Internet Security software, in the form of comparison tables, according to their platform (e.g. desktop and server, mobile, etc.)", 
     "totalDislikes" : 0, 
     "totalChildDecisions" : 59, 
     "totalCriteria" : 19, 
     "multiVotesAllowed" : false, 
     "totalCharacteristics" : 8, 
     "totalComments" : 0, 
     "totalFlags" : 0, 
     "likeSum" : 0.0, 
     "totalVotes" : 665, 
     "name" : "Antivirus software for Windows", 
     "totalLikes" : 0, 
     "createDate" : "2017-04-19T09:17:20.347Z" 
     } 
    }, { 
     "_index" : "neo4j-index-node", 
     "_type" : "Flaggable", 
     "_id" : "null", 
     "_score" : 1.0, 
     "_source" : { 
     "avgVotesWeight" : 0.0, 
     "updateDate" : "2017-04-19T09:17:36.883Z", 
     "nameSlug" : "antivirus-software-for-windows", 
     "lowerName" : "antivirus software for windows", 
     "description" : "This is a non-exhaustive list of notable antivirus and Internet Security software, in the form of comparison tables, according to their platform (e.g. desktop and server, mobile, etc.)", 
     "totalDislikes" : 0, 
     "totalChildDecisions" : 59, 
     "totalCriteria" : 19, 
     "multiVotesAllowed" : false, 
     "totalCharacteristics" : 8, 
     "totalComments" : 0, 
     "totalFlags" : 0, 
     "likeSum" : 0.0, 
     "totalVotes" : 665, 
     "name" : "Antivirus software for Windows", 
     "totalLikes" : 0, 
     "createDate" : "2017-04-19T09:17:20.347Z" 
     } 
    }, { 
     "_index" : "neo4j-index-node", 
     "_type" : "Likeable", 
     "_id" : "null", 
     "_score" : 1.0, 
     "_source" : { 
     "avgVotesWeight" : 0.0, 
     "updateDate" : "2017-04-19T09:17:36.883Z", 
     "nameSlug" : "antivirus-software-for-windows", 
     "lowerName" : "antivirus software for windows", 
     "description" : "This is a non-exhaustive list of notable antivirus and Internet Security software, in the form of comparison tables, according to their platform (e.g. desktop and server, mobile, etc.)", 
     "totalDislikes" : 0, 
     "totalChildDecisions" : 59, 
     "totalCriteria" : 19, 
     "multiVotesAllowed" : false, 
     "totalCharacteristics" : 8, 
     "totalComments" : 0, 
     "totalFlags" : 0, 
     "likeSum" : 0.0, 
     "totalVotes" : 665, 
     "name" : "Antivirus software for Windows", 
     "totalLikes" : 0, 
     "createDate" : "2017-04-19T09:17:20.347Z" 
     } 
    }, { 
     "_index" : "neo4j-index-node", 
     "_type" : "Commentable", 
     "_id" : "null", 
     "_score" : 1.0, 
     "_source" : { 
     "avgVotesWeight" : 0.0, 
     "updateDate" : "2017-04-19T09:17:36.883Z", 
     "nameSlug" : "antivirus-software-for-windows", 
     "lowerName" : "antivirus software for windows", 
     "description" : "This is a non-exhaustive list of notable antivirus and Internet Security software, in the form of comparison tables, according to their platform (e.g. desktop and server, mobile, etc.)", 
     "totalDislikes" : 0, 
     "totalChildDecisions" : 59, 
     "totalCriteria" : 19, 
     "multiVotesAllowed" : false, 
     "totalCharacteristics" : 8, 
     "totalComments" : 0, 
     "totalFlags" : 0, 
     "likeSum" : 0.0, 
     "totalVotes" : 665, 
     "name" : "Antivirus software for Windows", 
     "totalLikes" : 0, 
     "createDate" : "2017-04-19T09:17:20.347Z" 
     } 
    } ] 
    } 
} 

为什么所有的决策的子类(如VotableLikeable)也被复制吗?正如你可以从我的配置看,我曾试图排除一切除外:

com.graphaware.module.ES.node=hasLabel('Decision')

我的目标是在指数仅ES节点Decision

此外,为什么从〜60的唯一的单一决定是索引在那里?我认为Elasticsearch JSON输出中的“_id”:“null”与此问题有关。我究竟做错了什么 ?

回答

1

看来我们的文档已经怪异关于内部ID的使用为文档ID:如果您 com.graphaware.module.UIDM.uuidProperty=ID()

通过这个

com.graphaware.module.ES.keyProperty=ID()

但是:

替换该行同样使用uuid模块,最好使用“uuid”而不是内部ID

我在社区3.1.3上测试了所提到的版本,它正在工作。

{ "took" : 1, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" :{ "_index" : "neo4j-index-node", "_type" : "Decision", "_id" : "2", "_score" : 1.0, "_source":{"id":123,"title":"Ibiza"} }, { "_index" : "neo4j-index-node", "_type" : "Decision", "_id" : "3", "_score" : 1.0, "_source":{"id":123,"title":"Weird Decision"} } ] } }

如果节点有两个标签,决策和可投票,那么你必须排除它们在配置上是这样的:

com.graphaware.module.ES.node=hasLabel('Decision') && !hasLabel('Votable') && !hasLabel('BaseEntity')