cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Creating named indexes prior to 3.5

mdfrenchman
Graph Voyager

Hi everyone,

I'm looking at creating named indexes and have run into a roadblock of sorts. We're currently on neo4j 3.4.x with plans to upgrade to 3.5.5 in the next few months. In the mean time I'd like to proceed with building out named indexes.

From what I can tell, you can only name an index in the following ways:

  • Prior to 3.5.x by using explicit indexes.
CALL db.index.explicit.addNode('name', ...)
  • 3.5.x by using explicit, and fulltext multi-token indexes
CALL db.index.fulltext.createNodeIndex("titlesAndDescriptions",["Movie", "Book"],["title", "description"])

The problem is, the explicit indexes are depreciated and will be removed in version 4.

So anyone know if there is another way to create named indexes, or do I just need to pause on this until after we've upgraded to 3.5.5?

Thanks!
Mike French

5 REPLIES 5

What's your use case? Why do you think you need "named" indexes?

If the answer is "i want fulltext indexing" than the easiest is to use APOC. APOC basically uses manual (==explicit) indexes with a update trigger.

If you don't require full text search, the "normal" schema indexes via CREATE INDEX ... should be good enough.

We're dealing with a big, gotcha, we aren't allowed to use APOC.

Naming is primarily to manage schema, to dynamically CREATE/DROP INDEX, it was a bit of a pain to match against the whole description and noticed that names were null for "normal" indexes. Being able to match name was just a bit easier. Again, this is similar to what we could do with APOC, but alas we aren't allowed.

A second driver on this was maintaining schema consistency. Being able to create or drop an index and not have an error because it already existed, or didn't exist in case of the DROP.

I guess a follow on question, is there anyway to have "normal" schema indexes with a name?

Schema indexes currently don't have a name assigned to. However this might change in upcoming version.

The questions basically: why do you think you need named indexes?

Stefan,
After stepping back and really thinking on that question. You're probably right; I don't absolutely need them named. I can accomplish what I wanted to without them being named in the graph.
Also, it made me realize I was overthinking the use cases for the fulltext multi-token indexes. It's applicable in some of our cases but others it just didn't make sense.

To answer your question though, I'm naming them in the domain layer to keep them organized for scaffolding purposes. Lazy me thought it'd be easier if that mapped directly to the index in the graph. I can still \use the name to group domain side but do the comparisons with the label and properties, instead of comparison with the name. This, while slightly more complicated, is probably better for consistency in the end anyway.

Thanks for the response and forcing me to revisit the core problem