<p dir="auto">Given is the following graph for Neo4j 2.1.7:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="CREATE 
(:Application {Name: &quot;Test Application&quot;, Aliases: [&quot;Test&quot;, &quot;App&quot;, &quot;TestProject&quot;]}),
(:Application {Name: &quot;Another Application&quot;, Aliases: [&quot;A-App&quot;, &quot;XYZ&quot;, &quot;XYProject&quot;]}),
(:Application {Name: &quot;Database X&quot;, Aliases: [&quot;DB-App&quot;, &quot;DB&quot;, &quot;DB-Project&quot;]}),
(:System {Name: &quot;Server1&quot;, Application: &quot;TestProject&quot;}),
(:System {Name: &quot;Server2&quot;, Application: &quot;Test Application&quot;}),
(:System {Name: &quot;Server3&quot;, Application: &quot;another App&quot;}),
(:System {Name: &quot;Server4&quot;, Application: &quot;Some Database&quot;}),
(:System {Name: &quot;Server5&quot;, Application: &quot;App&quot;}),
(:System {Name: &quot;Server6&quot;, Application: &quot;App XY&quot;}),
(:System {Name: &quot;Server7&quot;, Application: &quot;App DB&quot;}),
(:System {Name: &quot;Server8&quot;, Application: &quot;Test&quot;}),
(:System {Name: &quot;Server9&quot;, Application: &quot;TestProject&quot;}),
(:System {Name: &quot;Server10&quot;, Application: &quot;test&quot;}),
(:System {Name: &quot;Server11&quot;, Application: &quot;App XY&quot;});

CREATE INDEX ON :Application(Name);
CREATE INDEX ON :Application(Aliases);

CREATE INDEX ON :System(Application);"><pre class="notranslate"><code class="notranslate">CREATE 
(:Application {Name: "Test Application", Aliases: ["Test", "App", "TestProject"]}),
(:Application {Name: "Another Application", Aliases: ["A-App", "XYZ", "XYProject"]}),
(:Application {Name: "Database X", Aliases: ["DB-App", "DB", "DB-Project"]}),
(:System {Name: "Server1", Application: "TestProject"}),
(:System {Name: "Server2", Application: "Test Application"}),
(:System {Name: "Server3", Application: "another App"}),
(:System {Name: "Server4", Application: "Some Database"}),
(:System {Name: "Server5", Application: "App"}),
(:System {Name: "Server6", Application: "App XY"}),
(:System {Name: "Server7", Application: "App DB"}),
(:System {Name: "Server8", Application: "Test"}),
(:System {Name: "Server9", Application: "TestProject"}),
(:System {Name: "Server10", Application: "test"}),
(:System {Name: "Server11", Application: "App XY"});

CREATE INDEX ON :Application(Name);
CREATE INDEX ON :Application(Aliases);

CREATE INDEX ON :System(Application);
</code></pre></div>
<p dir="auto"><strong>Following queries are using the schema index:</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PROFILE 
MATCH (a:Application { Name: &quot;Test Application&quot; })
MATCH (s:System)
WHERE s.Application = a.Name
RETURN a,s;

neo4j-sh (?)$ PROFILE  MATCH (a:Application { Name: &quot;Test Application&quot; }) MATCH (s:System) WHERE s.Application = a.Name RETURN a,s;
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | a                                                                     | s                                                      |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[4]{Name:&quot;Server2&quot;,Application:&quot;Test Application&quot;} |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; 1 row
==&gt;
==&gt; SchemaIndex(0)
==&gt;   |
==&gt;   +SchemaIndex(1)
==&gt;
==&gt; +----------------+------+--------+-------------+-------------------------------------------+
==&gt; |       Operator | Rows | DbHits | Identifiers |                                     Other |
==&gt; +----------------+------+--------+-------------+-------------------------------------------+
==&gt; | SchemaIndex(0) |    1 |      4 |        s, s | Property(a,Name(0)); :System(Application) |
==&gt; | SchemaIndex(1) |    1 |      2 |        a, a |       {  AUTOSTRING0}; :Application(Name) |
==&gt; +----------------+------+--------+-------------+-------------------------------------------+
==&gt;
==&gt; Total database accesses: 6"><pre class="notranslate"><code class="notranslate">PROFILE 
MATCH (a:Application { Name: "Test Application" })
MATCH (s:System)
WHERE s.Application = a.Name
RETURN a,s;

neo4j-sh (?)$ PROFILE  MATCH (a:Application { Name: "Test Application" }) MATCH (s:System) WHERE s.Application = a.Name RETURN a,s;
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | a                                                                     | s                                                      |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[4]{Name:"Server2",Application:"Test Application"} |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; 1 row
==&gt;
==&gt; SchemaIndex(0)
==&gt;   |
==&gt;   +SchemaIndex(1)
==&gt;
==&gt; +----------------+------+--------+-------------+-------------------------------------------+
==&gt; |       Operator | Rows | DbHits | Identifiers |                                     Other |
==&gt; +----------------+------+--------+-------------+-------------------------------------------+
==&gt; | SchemaIndex(0) |    1 |      4 |        s, s | Property(a,Name(0)); :System(Application) |
==&gt; | SchemaIndex(1) |    1 |      2 |        a, a |       {  AUTOSTRING0}; :Application(Name) |
==&gt; +----------------+------+--------+-------------+-------------------------------------------+
==&gt;
==&gt; Total database accesses: 6
</code></pre></div>
<h2 dir="auto"></h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PROFILE 
MATCH (a:Application { Name: &quot;Test Application&quot; })
MATCH (s:System)
WHERE s.Application IN a.Aliases
RETURN a,s;

neo4j-sh (?)$ PROFILE  MATCH (a:Application { Name: &quot;Test Application&quot; }) MATCH (s:System) WHERE s.Application IN a.Aliases RETURN a,s;
==&gt; +----------------------------------------------------------------------------------------------------------------------------+
==&gt; | a                                                                     | s                                                  |
==&gt; +----------------------------------------------------------------------------------------------------------------------------+
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[10]{Name:&quot;Server8&quot;,Application:&quot;Test&quot;}        |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[7]{Name:&quot;Server5&quot;,Application:&quot;App&quot;}          |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[3]{Name:&quot;Server1&quot;,Application:&quot;TestProject&quot;}  |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[11]{Name:&quot;Server9&quot;,Application:&quot;TestProject&quot;} |
==&gt; +----------------------------------------------------------------------------------------------------------------------------+
==&gt; 4 rows
==&gt;
==&gt; SchemaIndex(0)
==&gt;   |
==&gt;   +SchemaIndex(1)
==&gt;
==&gt; +----------------+------+--------+-------------+----------------------------------------------+
==&gt; |       Operator | Rows | DbHits | Identifiers |                                        Other |
==&gt; +----------------+------+--------+-------------+----------------------------------------------+
==&gt; | SchemaIndex(0) |    4 |      9 |        s, s | Property(a,Aliases(1)); :System(Application) |
==&gt; | SchemaIndex(1) |    1 |      2 |        a, a |          {  AUTOSTRING0}; :Application(Name) |
==&gt; +----------------+------+--------+-------------+----------------------------------------------+
==&gt;
==&gt; Total database accesses: 11"><pre class="notranslate"><code class="notranslate">PROFILE 
MATCH (a:Application { Name: "Test Application" })
MATCH (s:System)
WHERE s.Application IN a.Aliases
RETURN a,s;

neo4j-sh (?)$ PROFILE  MATCH (a:Application { Name: "Test Application" }) MATCH (s:System) WHERE s.Application IN a.Aliases RETURN a,s;
==&gt; +----------------------------------------------------------------------------------------------------------------------------+
==&gt; | a                                                                     | s                                                  |
==&gt; +----------------------------------------------------------------------------------------------------------------------------+
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[10]{Name:"Server8",Application:"Test"}        |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[7]{Name:"Server5",Application:"App"}          |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[3]{Name:"Server1",Application:"TestProject"}  |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[11]{Name:"Server9",Application:"TestProject"} |
==&gt; +----------------------------------------------------------------------------------------------------------------------------+
==&gt; 4 rows
==&gt;
==&gt; SchemaIndex(0)
==&gt;   |
==&gt;   +SchemaIndex(1)
==&gt;
==&gt; +----------------+------+--------+-------------+----------------------------------------------+
==&gt; |       Operator | Rows | DbHits | Identifiers |                                        Other |
==&gt; +----------------+------+--------+-------------+----------------------------------------------+
==&gt; | SchemaIndex(0) |    4 |      9 |        s, s | Property(a,Aliases(1)); :System(Application) |
==&gt; | SchemaIndex(1) |    1 |      2 |        a, a |          {  AUTOSTRING0}; :Application(Name) |
==&gt; +----------------+------+--------+-------------+----------------------------------------------+
==&gt;
==&gt; Total database accesses: 11
</code></pre></div>
<p dir="auto"><strong>While combined with OR operator are not:</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PROFILE 
MATCH (a:Application { Name: &quot;Test Application&quot;})
MATCH (s:System)
WHERE s.Application = a.Name OR s.Application IN a.Aliases
RETURN a,s;

neo4j-sh (?)$ PROFILE  MATCH (a:Application { Name: &quot;Test Application&quot;}) MATCH (s:System) WHERE s.Application = a.Name OR s.Application IN a.Aliases RETURN a,s;
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | a                                                                     | s                                                      |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[3]{Name:&quot;Server1&quot;,Application:&quot;TestProject&quot;}      |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[4]{Name:&quot;Server2&quot;,Application:&quot;Test Application&quot;} |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[7]{Name:&quot;Server5&quot;,Application:&quot;App&quot;}              |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[10]{Name:&quot;Server8&quot;,Application:&quot;Test&quot;}            |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[11]{Name:&quot;Server9&quot;,Application:&quot;TestProject&quot;}     |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; 5 rows
==&gt; 
==&gt; Filter
==&gt;   |
==&gt;   +NodeByLabel
==&gt;     |
==&gt;     +SchemaIndex
==&gt; 
==&gt; +-------------+------+--------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
==&gt; |    Operator | Rows | DbHits | Identifiers |                                                                                                                                             Other |
==&gt; +-------------+------+--------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
==&gt; |      Filter |    5 |    126 |             | (Property(s,Application(2)) == Property(a,Name(0)) OR any(-_-INNER-_- in Property(a,Aliases(1)) where Property(s,Application(2)) == -_-INNER-_-)) |
==&gt; | NodeByLabel |   11 |     12 |        s, s |                                                                                                                                           :System |
==&gt; | SchemaIndex |    1 |      2 |        a, a |                                                                                                               {  AUTOSTRING0}; :Application(Name) |
==&gt; +-------------+------+--------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
==&gt; 
==&gt; Total database accesses: 140"><pre class="notranslate"><code class="notranslate">PROFILE 
MATCH (a:Application { Name: "Test Application"})
MATCH (s:System)
WHERE s.Application = a.Name OR s.Application IN a.Aliases
RETURN a,s;

neo4j-sh (?)$ PROFILE  MATCH (a:Application { Name: "Test Application"}) MATCH (s:System) WHERE s.Application = a.Name OR s.Application IN a.Aliases RETURN a,s;
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | a                                                                     | s                                                      |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[3]{Name:"Server1",Application:"TestProject"}      |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[4]{Name:"Server2",Application:"Test Application"} |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[7]{Name:"Server5",Application:"App"}              |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[10]{Name:"Server8",Application:"Test"}            |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[11]{Name:"Server9",Application:"TestProject"}     |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; 5 rows
==&gt; 
==&gt; Filter
==&gt;   |
==&gt;   +NodeByLabel
==&gt;     |
==&gt;     +SchemaIndex
==&gt; 
==&gt; +-------------+------+--------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
==&gt; |    Operator | Rows | DbHits | Identifiers |                                                                                                                                             Other |
==&gt; +-------------+------+--------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
==&gt; |      Filter |    5 |    126 |             | (Property(s,Application(2)) == Property(a,Name(0)) OR any(-_-INNER-_- in Property(a,Aliases(1)) where Property(s,Application(2)) == -_-INNER-_-)) |
==&gt; | NodeByLabel |   11 |     12 |        s, s |                                                                                                                                           :System |
==&gt; | SchemaIndex |    1 |      2 |        a, a |                                                                                                               {  AUTOSTRING0}; :Application(Name) |
==&gt; +-------------+------+--------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
==&gt; 
==&gt; Total database accesses: 140
</code></pre></div>
<p dir="auto"><strong>But this one works??</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PROFILE 
MATCH (a:Application { Name: &quot;Test Application&quot;})
MATCH (s:System)
WHERE s.Application IN (a.Aliases + a.Name)
RETURN a,s;

neo4j-sh (?)$ PROFILE  MATCH (a:Application { Name: &quot;Test Application&quot;}) MATCH (s:System) WHERE s.Application IN (a.Aliases + a.Name) RETURN a,s;
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | a                                                                     | s                                                      |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[10]{Name:&quot;Server8&quot;,Application:&quot;Test&quot;}            |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[7]{Name:&quot;Server5&quot;,Application:&quot;App&quot;}              |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[3]{Name:&quot;Server1&quot;,Application:&quot;TestProject&quot;}      |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[11]{Name:&quot;Server9&quot;,Application:&quot;TestProject&quot;}     |
==&gt; | Node[0]{Name:&quot;Test Application&quot;,Aliases:[&quot;Test&quot;,&quot;App&quot;,&quot;TestProject&quot;]} | Node[4]{Name:&quot;Server2&quot;,Application:&quot;Test Application&quot;} |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; 5 rows
==&gt; 
==&gt; SchemaIndex(0)
==&gt;   |
==&gt;   +SchemaIndex(1)
==&gt; 
==&gt; +----------------+------+--------+-------------+-----------------------------------------------------------------------+
==&gt; |       Operator | Rows | DbHits | Identifiers |                                                                 Other |
==&gt; +----------------+------+--------+-------------+-----------------------------------------------------------------------+
==&gt; | SchemaIndex(0) |    5 |     13 |        s, s | Add(Property(a,Aliases(1)),Property(a,Name(0))); :System(Application) |
==&gt; | SchemaIndex(1) |    1 |      2 |        a, a |                                   {  AUTOSTRING0}; :Application(Name) |
==&gt; +----------------+------+--------+-------------+-----------------------------------------------------------------------+
==&gt; 
==&gt; Total database accesses: 15"><pre class="notranslate"><code class="notranslate">PROFILE 
MATCH (a:Application { Name: "Test Application"})
MATCH (s:System)
WHERE s.Application IN (a.Aliases + a.Name)
RETURN a,s;

neo4j-sh (?)$ PROFILE  MATCH (a:Application { Name: "Test Application"}) MATCH (s:System) WHERE s.Application IN (a.Aliases + a.Name) RETURN a,s;
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | a                                                                     | s                                                      |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[10]{Name:"Server8",Application:"Test"}            |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[7]{Name:"Server5",Application:"App"}              |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[3]{Name:"Server1",Application:"TestProject"}      |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[11]{Name:"Server9",Application:"TestProject"}     |
==&gt; | Node[0]{Name:"Test Application",Aliases:["Test","App","TestProject"]} | Node[4]{Name:"Server2",Application:"Test Application"} |
==&gt; +--------------------------------------------------------------------------------------------------------------------------------+
==&gt; 5 rows
==&gt; 
==&gt; SchemaIndex(0)
==&gt;   |
==&gt;   +SchemaIndex(1)
==&gt; 
==&gt; +----------------+------+--------+-------------+-----------------------------------------------------------------------+
==&gt; |       Operator | Rows | DbHits | Identifiers |                                                                 Other |
==&gt; +----------------+------+--------+-------------+-----------------------------------------------------------------------+
==&gt; | SchemaIndex(0) |    5 |     13 |        s, s | Add(Property(a,Aliases(1)),Property(a,Name(0))); :System(Application) |
==&gt; | SchemaIndex(1) |    1 |      2 |        a, a |                                   {  AUTOSTRING0}; :Application(Name) |
==&gt; +----------------+------+--------+-------------+-----------------------------------------------------------------------+
==&gt; 
==&gt; Total database accesses: 15
</code></pre></div>
<p dir="auto">Ported from <a href="http://stackoverflow.com/questions/28746293/cypher-2-not-using-schema-index-with-or-operator" rel="nofollow">StackOverflow</a></p>
<p dir="auto">You guys might already be working on this, but this is a somewhat common use case that was easy with the old index syntax, and entirely too inefficient with the new indexes. Index hinting on this type of query returns an error, and the query without an index hint does a label scan for horrid performance.</p>
<p dir="auto">Query:<br>
match a:Crew using index a:Crew(name)<br>
where a.name="Neo" or a.name="Cypher"<br>
return a;<br>
Error: org.neo4j.cypher.IndexHintException: Can't use an index hint without an equality comparison on the correct node property label combo.<br>
Label: <code class="notranslate">Crew</code><br>
Property name: <code class="notranslate">name</code></p>