Changing default ES index name prefix

Hi, is it possible to change the default prefix of Elasticsearch index names? Currently, when I define a mixed index, JanusGraph creates a correspoing index in ES named janusgraph_<index_name>. I would like to change the prefix for all indices to something like jgtest1_<index_name>. I tried following the documentation (https://docs.janusgraph.org/index-backend/elasticsearch/#janusgraph-indexx-and-indexxelasticsearch-options), adding this line to the JanusGraph server .properties file: index.search.elasticsearch.index-name = jgtest1 however, this does not seem to work. I know that this is a GLOBAL_OFFLINE option, so I stopped the server, changed the Cassandra keyspace name to create a new DB, and then restarted the server. After defining the schema and mixed indices the ES index names are still the same as before. Namely the prefix of the indices that are create is still janusgraph_, instead of jgtest1_. Isn't the index-name option supposed to work? Am I missing somthing? Thanks!
Solution:
Your configuration is generally correct except the index-name option. You added “elasticsearch” after “search” which isn’t a valid configuration option. Instead, try to use “index.search.index-name = jgidxtest”. Hopefully it should fix the issue you are having. Let me know otherwise.
Jump to solution
6 Replies
porunov
porunov5mo ago
Hi. You are right. “index.{yourIndex}.index-name” is the option you should use to specify the index name which will specify the index prefix in ElasticSearch. Perhaps you didn’t remove your indexes from ElasticSearch and you are observing previous indexes (unused indexes in your case). A typical migration would be: 1. Stop the JanusGraph cluster (including zombie instances if you have any). 2. Execute commands directly in your index backend (ElasticSearch in your case) to change all the index names. 3. Set the index-name option to the necessary name. 4. Start the cluster again. JanusGraph should notice this change and pick-up a proper indexes (assuming you properly changed names for all indexes in ElasticSearch). We do use index-name options with ElasticSearch and I can confirm it works as expected. Perhaps you had some zombie instances in your cluster which resulted in this option not being changed because JanusGraph assumes you had more live instances in your cluster and waits for them to be closed before changing this option. In this case I recommend force-close those zombie instances (see related answer when people had trouble changing GLOBAL_OFFLINE option: https://github.com/JanusGraph/janusgraph/discussions/3558#discussioncomment-4893330 ). However, you mentioned that you changed your Cassandra keyspace name which will result in the new cluster (which doesn’t have those zombie instances). Thus, it’s weird why wouldn’t this option work for you for a fresh cluster.
GitHub
How to set schema.default from 'none' to default · JanusGraph janus...
Describe the feature: Hello Team, We stricter our janusGraph schema by adding two configuration property to our schema e.g schema.constraints = true and schema.default='none'. Now it's ...
rpuga
rpuga5mo ago
@Oleksandr Porunov, thank you for your answer. I tried to start from a completely new instance of JanusGraph, Cassandra, and Elastisearch (a single node cluster setting from both the server and storage/index backends). Although I set the index-name to a different name, JanusGraph still used janusgraph as the prefix for the ES indices. I think there is something wrong I'm doing in the configuration file. Here is what I currently have:
gremlin.graph = org.janusgraph.core.JanusGraphFactory

storage.backend = cql
storage.hostname = cassandra1
storage.cql.keyspace = jgidxtest
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25

index.search.backend = elasticsearch
index.search.hostname = elasticsearch1
index.search.elasticsearch.index-name = jgidxtest
gremlin.graph = org.janusgraph.core.JanusGraphFactory

storage.backend = cql
storage.hostname = cassandra1
storage.cql.keyspace = jgidxtest
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25

index.search.backend = elasticsearch
index.search.hostname = elasticsearch1
index.search.elasticsearch.index-name = jgidxtest
Dispite changing the name, ES created these indices:
$ curl -XGET http://localhost:9200/_cat/indices/
yellow open janusgraph_lastseenemixedindex VOTTeC_5T9-UqcpUIKCKww 1 1 0 0 227b 227b 227b
yellow open janusgraph_namevmixedindex sfqlgiy4QY66T_vnUI1gsw 1 1 0 0 227b 227b 227b
yellow open janusgraph_firstseenemixedindex zkD21PZjRRSvuPtC5gy74A 1 1 0 0 227b 227b 227b
$ curl -XGET http://localhost:9200/_cat/indices/
yellow open janusgraph_lastseenemixedindex VOTTeC_5T9-UqcpUIKCKww 1 1 0 0 227b 227b 227b
yellow open janusgraph_namevmixedindex sfqlgiy4QY66T_vnUI1gsw 1 1 0 0 227b 227b 227b
yellow open janusgraph_firstseenemixedindex zkD21PZjRRSvuPtC5gy74A 1 1 0 0 227b 227b 227b
whereas I was expecteing indices that start with jgidxtest_. I feel that I'm doing something wrong when setting index.{yourIndex}.index-name. Specifically, I'm not entirely sure about what {yourIndex} should be. In the JanusGraph docs, it mentions index.[X].elasticsearch.index-name but again, I'm not sure what [X] should be in my case. I've seen some examples online where [X] is simply replaced with search, which is what I did, but that does not seem to work. Any thoughts on what the correct configuration line should be?
Solution
porunov
porunov5mo ago
Your configuration is generally correct except the index-name option. You added “elasticsearch” after “search” which isn’t a valid configuration option. Instead, try to use “index.search.index-name = jgidxtest”. Hopefully it should fix the issue you are having. Let me know otherwise.
rpuga
rpuga5mo ago
It worked, thank you so much! Does this mean that this page in the JanusGraph docs is incorrect? https://docs.janusgraph.org/index-backend/elasticsearch/ It explicitly mentions index.[X].elasticsearch.index-name as the option name, whereas the following page correctly indicates index.[X].index-name as the option to use. https://docs.janusgraph.org/configs/configuration-reference/
porunov
porunov5mo ago
That’s a good finding. Yes, I believe it’s a mistake. Configuration references page is generated automatically and can always act as the source of truth. Other documentation pages and manually handled which is why there are sometimes errors. Do you want to contribute the fix to the documentation? We can fix it if you can’t make a contribution.
rpuga
rpuga5mo ago
Sure, I'd be happy to contribute. I have not done this before, so I'll first need to read the related info and guidelines for contributing to the documentation (I found the janusgraph/CONTRIBUTING.md guide on GitHub). I was able to submit a pull request with the documentation fix (#4225)
Want results from more Discord servers?
Add your server
More Posts