All versions of this manual
X
 

Search index: JanusGraph

The janusGraphSearch connector is the recommended solution for full-text search for graphs with more than 100,000 nodes and edges.

JanusGraph search integration

Linkurious can use the builtin search indices managed by JanusGraph itself. You can either use the Web user-interface or edit the configuration file located at linkurious/data/config/production.json to set the index.vendor property to the value janusGraphSearch.

Configuration

To edit the JanusGraph data-source configuration, you can either use the Web user-interface or edit the configuration file located at linkurious/data/config/production.json.

Example configuration:

{
  "dataSources": [
    {
      "graphdb": {
        "vendor": "janusGraph",
        "url": "ws://127.0.0.1:8182/",
        "configuration": {
          "storage.backend": "cassandra",
          "storage.hostname": "127.0.0.1"
        }
      },
      "index": {
        "vendor": "janusGraphSearch",
        "create": true
      }
    }
  ]
}

Global vs Local configuration

The JanusGraph instance used by Linkurious can be configured via the configuration field as illustrated in the example above. Using this field, you can provide Linkurious a valid set of JanusGraph configuration options.

However, it's important to note that these are local configuration options. As opposed to the global configuration options, these options are only applicable if they have a MASKABLE or LOCAL mutability level. See Mutability Levels in JanusGraph.

If there are conflicts between the LOCAL and GLOBAL configuration values, JanusGraph may refuse to start or simply ignore the local configuration options and fallback on the globally managed values. This will likely produce unexpected results as Linkurious will be running with a different configuration than the one provided.

You can check the value of a GLOBAL configuration option with the Management API using the gremlin console, e.g.:

mgmt = graph.openManagement()
// Get the value of the configuration option 'index.search.backend' 
mgmt.get('index.search.backend') //elasticsearch 

The GLOBAL options can only be changed through the Management API of JanusGraph. In addition, changing GLOBAL_OFFLINE options requires restarting the cluster.

For example, if you want to change the index backend configuration:

// Open the management API 
mgmt = graph.openManagement()
// Force close all opened instances 
mgmt.getOpenInstances().each {if (!it.contains('current')) mgmt.forceCloseInstance(it)}
// Apply the changes 
mgmt.commit()
// Open the management API (All but the current instance are closed) 
mgmt = graph.openManagement()
// Change the GLOBAL_OFFLINE configuration option 
mgmt.set('index.search.backend', 'solr')
// Apply the changes 
mgmt.commit()

Solr Configuration

To use Solr as an index backend for JanusGraphSearch, you first need to create a Solr collection for indexing the nodes. A second collection must be created if you want to index the edges as well.

The collections should be named linkurious_index and linkurious_index_edges for nodes and edges respectively. Please refer to the Solr configuration overview on how to create a collection.

Here an example on how to provide Solr configuration information to Linkurious.

Example configuration:

{
  "dataSources": [
    {
      "graphdb": {
        "vendor": "janusGraph",
        "url": "ws://127.0.0.1:8182/",
        "configuration": {
          "storage.backend": "cassandra",
          "storage.hostname": "127.0.0.1",
          "index.search.backend": "solr",
          "index.search.solr.mode": "cloud",
          "index.search.solr.zookeeper-url": "localhost:9983"
        }
      },
      "index": {
        "vendor": "janusGraphSearch",
        "create": true
      }
    }
  ]
}

Linkurious will not override globally managed configuration values.

Supported index options with JanusGraphSearch:

  • create (optional): true to let Linkurious create the index if it does not exist
  • indexEdges (optional): true to enable search on edge properties
  • nodeIndexName (optional): Name of the index to use to search nodes (defaults to the first index created among the available indices)
  • edgeIndexName (optional): Name of the index to use to search edges (defaults to the first index created among the available indices)

Create a search index in JanusGraph

Linkurious will automatically create a search index in JanusGraph if the index option "create" is true. However, Linkurious can also use a mixed search index that already exist in JanusGraph.

Please refer to the JanusGraph documentation on how to create mixed indices if you want to create one directly.