2017-04-18 5 views
1

Je vais intégrer mon application Neo4j avec Elasticsearch. Je vais essayer le plugin Neo4j suivant de GraphAware https://github.com/graphaware/neo4j-to-elasticsearchNeo4j 3.1.3 avec l'intégration d'Elasticsearch

Pourriez-vous dire s'il supporte la version Neo4j 3.1.3? Aussi, quelle version d'ES devrait être utilisée là? Supporte-t-il ES 5.3.0 par exemple?

À l'heure actuelle, j'ai installé Elasticsearch 5.3.0 localement. Aussi j'ai ajouté 2 pots:

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

à mon dossier Neo4j CE 3.1.3\plugins\.

Aussi, j'ai ajouté la configuration suivante (comme descrbed ici https://github.com/neo4j-contrib/neo4j-elasticsearch#example) lignes dans ma configuration de base de données (Neo4j Community Edition\neo4j.conf):

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

Mais quand je l'insertion des données par rien du projet de printemps de données Neo4j arrive. Les index Elasticsearch sont toujours vides.

Qu'est-ce que je fais mal et comment le faire fonctionner?

MISE À JOUR

J'ai fait quelques progrès sur ce point:

Ceci est mon 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 

Dans ma demande, j'ai une entité: Decision. Decision est un type complexe avec une grande hiérarchie parent:

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

En ce moment je suis d'ajouter ~ 60 noeuds de décision à ma base de données Neo4j mais je suis incapable de voir tous à ES. Je ne peux voir que le premier avec une duplication par classe parente dans la hiérarchie.

Ce que ce que j'ai maintenant:

$ 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" 
     } 
    } ] 
    } 
} 

Pourquoi tous les sous-classes de la décision (comme Votable, Likeable) y sont également dupliqués? Comme vous pouvez le voir dans ma config j'ai essayé d'exclure tout sauf:

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

Mon but est d'indexer uniquement Decision noeuds à ES.

Aussi, pourquoi la seule décision unique de ~ 60 est-elle indexée là? Je pense que "_id": "null" à la sortie Elasticsearch JSON est lié à ce problème. Qu'est-ce que je fais mal ?

Répondre

1

Il semble que notre documentation a été bizarre sur l'utilisation de l'identifiant interne id document:

Remplacer cette ligne: com.graphaware.module.UIDM.uuidProperty=ID()

Par cette

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

Toutefois, si vous utilisez aussi le module uuid, il est préférable d'utiliser "uuid" au lieu de l'ID interne

J'ai testé sur la communauté 3.1.3 avec les versions mentionnées et cela fonctionne.

{ "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"} } ] } }

Si vos noeuds ont à la fois la décision étiquettes et votable alors vous devez les exclure dans la configuration comme ceci:

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