The problem is that this query is dynamically generated so I don't know in advance which level should be filtered and on which value I should filter (defined by a user).
I want to use a path because I need to return all nodes and relations from the given pattern, except a given level so I could explicitly define a query:
but I would like to ask if there is a way to do the same thing while using the path (return only path) because it simplifies the result parsing for me.
It's possible to do, but you can have some bad impact on the performances :
MATCH p=(n {name:'John'})-[:KNOWS]->(level 1)-[:ADDRESS]->(level 2)-[:COUNTRY]->(level 3)
WHERE head(tail(nodes(p))).value = 'XXXX' // your level 1 filter
RETURN tail(tail(nodes(p))), tail(tail(relationships(p))) // return all the level except the root and lvl1
In the WHERE clause, Neo4j is working on an array, so it can't use any indexes.