graphaware / neo4j-to-elasticsearch

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

Error while creating or updating node Expression #156

Closed rensphilipsen closed 4 years ago

rensphilipsen commented 5 years ago

Hi,

Im trying to use Cypher queries for my replication logic as explained in https://github.com/graphaware/neo4j-to-elasticsearch/blob/master/docs/json-mapper.md#using-cypher-queries-for-replication-logic-

Whenever I try this with a simple as query as just fetching the node's name, it returns a org.springframework.expression.spel.SpelParseException saying @16: EL1043E: Unexpected token. Expected 'rparen())' but was 'identifier'.

I'm using:

My mapping.json looks like this:

{
    "defaults": {
      "key_property": "uuid",
      "nodes_index": "default-index-node",
      "relationships_index": "default-index-relationship",
      "include_remaining_properties": true
    },
    "node_mappings": [
      {
        "condition": "hasLabel('City')",
        "index": "nodes-cities",
        "type": "cities",
        "properties": {
            "name": "getProperty('name')",
            "keywords": "query(MATCH (n) WHERE id(n) = {id} RETURN n.name AS value)"
        }
      }
    ],
    "relationship_mappings": [
     {
        "condition": "isType('HAS')",
        "index": "relationships-has",
        "type": "has"
      }
    ]
  }

My graphaware part of the neo4j.conf:

# Enable GraphAware server
org.neo4j.server.thirdparty_jaxrs_classes=com.graphaware.server=/graphaware
com.graphaware.runtime.enabled=true

#UIDM
com.graphaware.module.UIDM.1=com.graphaware.module.uuid.UuidBootstrapper
com.graphaware.module.UIDM.uuidProperty=uuid
com.graphaware.module.UIDM.initializeUntil=0
com.graphaware.module.UIDM.relationship=(true)

# Enable Elasticsearch plugin
com.graphaware.module.ES.1=com.graphaware.module.es.ElasticSearchModuleBootstrapper
com.graphaware.module.ES.uri=elastic
com.graphaware.module.ES.port=9200
com.graphaware.module.ES.keyProperty=uuid
com.graphaware.module.ES.mapping=com.graphaware.module.es.mapping.JsonFileMapping
com.graphaware.module.ES.file=mapping.json
com.graphaware.module.ES.queueSize=100
com.graphaware.module.ES.initializeUntil=0
com.graphaware.module.ES.retryOnError=true
rensphilipsen commented 4 years ago

I forget to add qoutes to the query, this: "keywords": "query(MATCH (n) WHERE id(n) = {id} RETURN n.name AS value)" Should be: "keywords": "query('MATCH (n) WHERE id(n) = {id} RETURN n.name AS value')"