neo4j-elasticsearch icon indicating copy to clipboard operation
neo4j-elasticsearch copied to clipboard

Support of Neo4j 4.0

Open sim51 opened this issue 5 years ago • 9 comments

Following the PR #40 this the continuation with the support of Neo4j 4.0

sim51 avatar Jun 02 '20 13:06 sim51

hi, I have tested your plugin it builds without problems. But the plugin crashes when trying to use it with neo4j. I am not a java expert, so I hope I did everything correctly ;). Pretty much all I did was:

mvn package

and then take the jar file "file:///home/tom/Dropbox/company/comcharax/neo4j-elasticsearch/target/neo4j-elasticsearch-4.0.1-all.jar" and move it into the plugins directory

--> here is the pastebin of the log: https://pastebin.com/zePAMd5p

on startup it say this:

neo4j_1                   | 2020-06-14 11:23:52.647+0000 INFO  [graph.db] [graph.db] Creating ElasticSearchLifecycle
neo4j_1                   | 2020-06-14 11:23:52.648+0000 INFO  [graph.db] [graph.db] Starting ElasticSearchLifecycle
neo4j_1                   | 2020-06-14 11:23:52.649+0000 INFO  [graph.db] [graph.db] Stopping ElasticSearch lifecycle

hope this helps!

yeus avatar Jun 14 '20 11:06 yeus

Hi @yeus

Thanks for the info. Have you configured the index spec ? As an example : elasticsearch.neo4j.index_spec=people:Person(first_name,last_name), places:Place(name)

It seems that the NPE comes from that. I will modify the code to avoid this error.

sim51 avatar Jun 14 '20 11:06 sim51

Thanks,

  • yes, I have included them but I am realizing that I used the "old" way of doing this using neo4j 3.5 which was without the .neo4j. in the configuration parameters. I assumed though that they were optional, as you can also do the indexing through a cypher call? My options now look like this: I am using docker and added them as environment variables inside the dockerfile which seems to work fine:
ENV NEO4J_dbms_security_procedures_unrestricted=elasticsearch.* \
    NEO4J_elasticsearch_neo4j_index__spec="people:Person(name), movies:Movie(title)" \
    NEO4J_elasticsearch_neo4j_host__name=http://elastic:9200
  • Additionally, as I upgraded my DB from 3.5, the default database was named "graph.db" and not "neo4j". Once I corrected these things and also downgraded from 4.0.4 to 4.0.1 it worked. I haven't tried yet whether the plugin works with 4.0.4 with all the other things from above in place.
  • Additionally, I had to turn off https aces to elastic search for the plugin to work.

summrizing I haven't tested which of all of the above things caused the actual error. I have to admit that the neo4j error log and also from the plugin are somewhat obscure to me ;).

yeus avatar Jun 14 '20 22:06 yeus

You can call the index mechanism with a cypher query, but the definition of the index must be in the neo4j configuration.

Moreover the neo4j (or in your case graph.db) is mandatory because Neo4j 4.X is multi-tenant, so you have to specify the database name.

For the HTTPS it's weird ...are you using a self signed certificate ?

sim51 avatar Jun 15 '20 08:06 sim51

I have just done a tiny modification in the code to correct your issue, ie. when there is no plugin configuration the db doesn't start.

sim51 avatar Jun 15 '20 11:06 sim51

Hi all,

I've been trying to get this to work with Neo4j 4.4.5 and ElasticSearch 8.1.2 but unfortunately no success. I am able to add the plugin and configurations to neo4j and neo4j is starting fine, but if I use for example: CALL elasticsearch.indexAll({ batchSize:500, async:false });

I do get the following error: Failed to invoke procedure elasticsearch.indexAll: Caused by: java.lang.Exception: Fail to perform bulk action : {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"}],"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"},"status":400}

I think this has something to do with the type mapping disabled in newer version of elasticsearch but not sure how to solve this.

Furthermore, I would like to know if indexing is also working for relationships?

Regards,

Zootje123 avatar Apr 20 '22 07:04 Zootje123

hi @Zootje123 were you able to resolve the issue? I'm using the same neo4j version and ElasticSearch. Wondering if I should use this plugin for indexing the neo4j data to ElasticSearch or find out another better one.

Tin-Nguyen avatar May 06 '22 11:05 Tin-Nguyen

FYI, you can take a look at this project which is more up to date https://gitlab.com/ouestware/neo4j-elasticsearch This PR has not been merge since a year, so I need to redo one with the new updated code, but I haven't found the time yet...

sim51 avatar May 06 '22 12:05 sim51

thanks @sim51

Tin-Nguyen avatar May 06 '22 12:05 Tin-Nguyen