Multiple Properties Index in Neo4j / Cypher

Is it possible to create an index with multiple properties in cypher?

I mean something like

CREATE INDEX ON :Person(first_name, last_name)

If I understand correctly, this is not possible, but if I want to write queries, for example:

MATCH (n:Person)
WHERE n.first_name = 'Andres' AND n.last_name = 'Doe'
RETURN n

Do these indexes make sense?

CREATE INDEX ON :Person(first_name)
CREATE INDEX ON :Person(last_name)

Or should I try to combine "first_name" and "last_name" in one property?

Thanks!

+4
source share
2 answers

Indexes are good for defining some key that maps to a certain value or set of values. The key is always the only dimension.

Consider your example:

CREATE INDEX ON :Person(first_name)
CREATE INDEX ON :Person(last_name)

, . , : .

, . ? . , / . , JOHN . , , SMITH .

, , , JOHN SMITH. person.full_name. , :

  • CREATE INDEX ON :Person(full_name)
    
  • Match

    MATCH (n:Person)
    USING INDEX n:Person(full_name)
    WHERE n.full_name = 'JOHN SMITH'
    

http://docs.neo4j.org/refcard/2.0/ .

,

Kenny

+10

3.2, Neo4j . :

CREATE INDEX ON :Person(first_name, last_name)

.

+1

All Articles