Article DetailsDetailsHelp Details Problem statement: Full-text indexes store their properties in fulltext-index.properties file at NEO4J_HOME/data/databases/graph.db/schema/index/fulltext-1.0/. If a new full text index is created with non-default configurations e.g. via CALL db.index.fulltext.createNodeIndex("searchEmailsIndex",["Email"], ["email"]) - {}`which is intended to use the non-default `email analyser (default in 3.5 is standard), such custom index properties are not propagated to other cluster instances (whether Causal Cluster or HA).That is because a full text index or any changes to it, are not automatically propagated/replicated through the cluster. Therefore, follower cores in a causal cluster or slaves on HA will not have that index or its properties available to be queried. A quick test is shown below: 1- Execute below on any Causal cluster instance or the master instance on HA: CREATE (u:User {user_id: 'test1@myemail.com'}) call db.index.fulltext.queryNodes('myuser', '*test1@myemail.com*') which will results in: {"user_id": "test1@myemail.com"} 2- Next, on a follower or slave instance, query the created index as: call db.index.fulltext.queryNodes(‘myuser’, '*test1@myemail.com*') Above will return empty, despite u:User {user_id: 'test1@myemail.com’} being present on that follower/slave instance. This shows that the data propagation works fine in general through the cluster, but index updates do not. Above is mentioned in neo4j configuration documents, essentially stating that replication and backups of full-text indexes, are experimental features in 3.5 (See https://neo4j.com/docs/cypher-manual/3.5/schema/index/#schema-index-fulltext-search-manage). Merging the two functionalities pre 4.0 is not possible, since it requires a store format change which since 3.5 occurs in 4.0. An issue here might be that HA doesn’t exist in 4.x, only Causal Clustering. Workaround: A workaround meanwhile in 3.5 is to rebuild the indexes on the followers/slaves with the desired custom configurations (e.g. analyser) as below: 1- Shutdown follower/slave instance. 2- Update config setting dbms.index.fulltext.default_analyzer=<analyzerName> as required. 3- Delete index files for the given index. NOTE! Only for the given index, because all full-text indexes that will be rebuilt will use the configured analyser. 4- Start up the follower/slave instance. 5- Index should now be rebuilt with the configured analyser (or the required custom configuration). An alternative approach may be to: 1- Drop the index 2- Ensure all machines have the same custom configuration setting e.g. dbms.index.fulltext.default_analyzer=<analyzerName> (needs neo4j restart of the concerned instance) 3- Create the index which should now use the configured property (analyser in this case). Below is a more granular view of the steps: This was achieved the expected index query behaviour on the two slaves with t he following process: 1- Shut down neo4j on the follower/slave instance ./neo4j stop. 2- $ jps ⇒ .. NEO4J NOT RUNNING 3- Identify the index id of the concerned index with a call db.indexes() (in this example it was 243). 4- ls $NEO4J_HOME/data/databases/graph.db/schema/index/fulltext-1.0/243/fulltext-1.0/. The fulltext-index.properties file listed, contains configurations for the particular index fulltext-index.properties failure-message 5- nano fulltext-index.properties Auto-generated file. Do not modify! <date> _name=myemailAnalyzerIndex eventually_consistent=false propertyNames=[email] _propertyIds=[0] _schema_entityType=NODE _schema_entityTokenIds=[1] analyzer=standard Note that it is not safe to modify this file in general. In this case however, we manually set analyser=email above. 6- Delete the index files as rm -r 1 (in this case it was named 1) Note, if there are more directories in here with number names, we need to delete them as well. 7- start neo4j and the index will be rebuilt with updated analyser. This needs to be done on all followers/slaves. Similar to the above, it may be noted that a neo4j-admin backup does not back up the fulltext-index.properties file at $NEO4J_HOME/data/databases/graph.db/schema/index/fulltext-1.0/243/fulltext-1.0/ in the above example. A similar workaround exists which essentially involves taking a manual copy of the fulltext-index.properties file, followed by a database backup, either via neo4j-admin dump/load or neo4j-admin backup, then restoring the backup, starting up Neo4j, dropping and recreating the relevant full-text index as mentioned above, placing the earlier backed up fulltext-index.properties file under the id directory of the index e.g. $NEO4J_HOME/data/databases/graph.db/schema/index/fulltext-1.0/25/fulltext-1.0/ and restarting Neo4j. References: https://neo4j.com/docs/cypher-manual/3.5/schema/index/#schema-index-fulltext-search-manage https://neo4j.com/docs/cypher-manual/current/administration/indexes-for-full-text-search/#administration-indexes-fulltext-search-manage Last Modified: 2020-08-20 12:54:57 UTC by Umar Muzammil. Relevant for Neo4j Versions: 3.4, 3.5. Relevant keywords full, text, index, analyser. InformationTitleManually restoring and replicating FTS indexes pre 4.0Article Created Date3/15/2024, 10:56 PMURL Name360051190673-Manually-restoring-and-replicating-FTS-indexes-pre-4-0Last Modified Date5/8/2024, 4:29 AM