graphaware / neo4j-to-elasticsearch

GraphAware Framework Module for Integrating Neo4j with Elasticsearch
261 stars 57 forks source link

Feature Request: Queries in dynamic index naming #144

Closed DaveClissold closed 3 years ago

DaveClissold commented 5 years ago

Not sure if it merits looking at, but would it be possible to add queries to the dynamic index naming? I have a relationship that is getting mapped, but have ran into a case where it would be useful to be able to create an index for each node either side of the relationship.

My exact case would be something like this

"index": "similar-"+"query('MATCH (a)-[n]-(b) WHERE id(n) = {id} AND id(a) < id(b) RETURN a.uuid AS value')"

and then I can reverse the id(a) > id(b)

Not sure if this is possible, but would be useful if possible

ikwattro commented 5 years ago

We're open to additional features. That said I'm not sure to grasp the use case here, what problem is it solving ?

Once this is cleared up, I don't see to much problems for this technically, just that it might slow down your replication

DaveClissold commented 5 years ago

For my use case I potentially have 4-5k nodes which have the same relationship from a starting node, if the end user is viewing the original node it would be useful to collate all the nodes this way. But because the relationship is 2 way we need to be able to reverse the process, so each node can be accessed and present the connected nodes via that relationship. Have tried to work with nesting the data into a single document, but ES overwrites the first with the 2nd node data, even though I return them in the same query as a single value.

ikwattro commented 5 years ago

@DaveClissold this is the issue of relying only on ES for context based queries IMO. However dynamic index names based on queries is something I have no objection to add tho. I cannot give an estimation time for now but I'll not forget it.