Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of Neo4j 4.0 #61

Open
wants to merge 7 commits into
base: 3.4
Choose a base branch
from
Open

Conversation

sim51
Copy link

@sim51 sim51 commented Jun 2, 2020

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

sim51 added 4 commits June 2, 2020 12:00
* Adding testcontainer for tests
* Adding cypher procedure for indexing db to es
* Compatibility with Neo4j complex types
* Bump versions in pom.xml
* Adding configuration to disable the use of type in ES indexation (removed in new ES version)
* Adding ES Auth
* Adding configuration for ES timeout
@yeus
Copy link

yeus commented Jun 14, 2020

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!

@sim51
Copy link
Author

sim51 commented Jun 14, 2020

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.

@yeus
Copy link

yeus commented Jun 14, 2020

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 ;).

@sim51
Copy link
Author

sim51 commented Jun 15, 2020

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
Copy link
Author

sim51 commented Jun 15, 2020

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.

@Zootje123
Copy link

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,

@Tin-Nguyen
Copy link

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.

@sim51
Copy link
Author

sim51 commented May 6, 2022

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...

@Tin-Nguyen
Copy link

thanks @sim51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants