neo4j-contrib / neo4j-elasticsearch

Neo4j ElasticSearch Integration
Apache License 2.0
210 stars 79 forks source link

merge properties from multiple neo4j nodes into one elasticsearch document possible? #25

Open bbernhard opened 8 years ago

bbernhard commented 8 years ago

Hi,

thanks for all the great work! I just tried neo4j-elasticsearch with the example provided in the documentation. That worked out of the box, without any problems. ;) Now I would like to do something more advaned with neo4j-elasticsearch and I am not really sure if that's possible.

I have the following neo4j schema User-[WORKS_AT]->Location and I would like to merge properties from both the User node and the Location node together into one elasticsearch document.

Is that somehow possible?

Greetings from Austria, Bernhard

jexp commented 8 years ago

One option is just to take the source and adapt it to your needs. I think generalizing this, might be a bit of a stretch.

Then we would have to allow an additional config that creates derived properties out of a cypher query. While it would be possible, and neat. I don't have the bandwidth right now to implement it.

Something like this:

elasticsearch.project_User=WITH _ as user MATCH (user)-[:WORKS_AT]->(l) RETURN user.name as name, location.address as address

would then store name and address properties in the ES index.

elasticsearch.project_User=WITH _ as user MATCH (user)-[:WORKS_AT]->(l) RETURN {name:user.name, loc:location.address} as info

would then store an info property in ES

santosh-hegde commented 7 years ago

Hi,

Is possible to index the nodes which satisfies some conditions.

for example: user:USER(id) where user.id="Santosh"

jexp commented 7 years ago

You could use the elasticsearch integreation of https://github.com/neo4j-contrib/neo4j-apoc-procedures to achieve that kind of one-off indexing, e.g. combined with the triggers there.

Here it would add a lot of complexity as you would have to define the filter-queries which are then run on every update.

Michael

On Fri, Nov 18, 2016 at 9:55 AM, santosh-hegde notifications@github.com wrote:

Hi,

Is possible to index the nodes which satisfies some conditions.

for example: user:USER(id) where user.id="Santosh"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/neo4j-contrib/neo4j-elasticsearch/issues/25#issuecomment-261480361, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEHY_Zf2YerIf0nLwhmSGcKqJBfxBCfks5q_WgZgaJpZM4KRteG .

jexp commented 7 years ago

Would the apoc approach work for you @santosh-hegde ?

santosh-hegde commented 7 years ago

Hi Michael,

I didn't try executing APOC Procedure. But elasticsearch.projectUser=WITH as user MATCH (user)-[:WORKS_AT]->(l) RETURN {name:user.name, loc:location.address} as info is not working to me.