Neo4j 3.5无法创建索引

时间:2018-12-29 08:39:17

标签: indexing neo4j cypher

一会儿

neo4j> CREATE INDEX ON :Temporal_Event(name);

我收到了:

2018-12-28 08:37:05.791+0000 INFO  Remote interface available at http://localhost:7474/
2018-12-28 11:11:46.963+0000 ERROR Client triggered an unexpected error [Neo.DatabaseError.General.IndexCorruptionDetected]: Index `Index( GENERAL, :Temporal_Event(name) )` has failed. Drop and recreate it to get it back online. Actual failure:
==================
java.lang.RuntimeException: java.lang.IllegalArgumentException: Index key-value size it to large. Please see index documentation for limitations. | GB+Tree[file:/SSD/data/databases/neo4j-dbpedia-AI.db/schema/index/native-btree-1.0/8/index-8, layout:GenericLayout[version:0.5, identifier:5643935348791705600, fixedSize:false], generation:2/4]
    at org.neo4j.kernel.impl.index.schema.WorkSyncedNativeIndexPopulator.add(WorkSyncedNativeIndexPopulator.java:94)
    at org.neo4j.kernel.impl.api.index.BatchingMultipleIndexPopulator.lambda$flush$2(BatchingMultipleIndexPopulator.java:170)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    at org.neo4j.helpers.NamedThreadFactory$2.run(NamedThreadFactory.java:122)
Caused by: java.lang.IllegalArgumentException: Index key-value size it to large. Please see index documentation for limitations. | GB+Tree[file:/SSD/data/databases/neo4j-dbpedia-AI.db/schema/index/native-btree-1.0/8/index-8, layout:GenericLayout[version:0.5, identifier:5643935348791705600, fixedSize:false], generation:2/4]
    at org.neo4j.index.internal.gbptree.TreeNodeDynamicSize.validateKeyValueSize(TreeNodeDynamicSize.java:369)
    at org.neo4j.index.internal.gbptree.InternalTreeLogic.insert(InternalTreeLogic.java:353)
    at org.neo4j.index.internal.gbptree.GBPTree$SingleWriter.merge(GBPTree.java:1281)
    at org.neo4j.kernel.impl.index.schema.NativeIndexUpdater.processAdd(NativeIndexUpdater.java:133)
    at org.neo4j.kernel.impl.index.schema.NativeIndexUpdater.processUpdate(NativeIndexUpdater.java:88)
    at org.neo4j.kernel.impl.index.schema.NativeIndexPopulator.processUpdates(NativeIndexPopulator.java:286)
    at org.neo4j.kernel.impl.index.schema.NativeIndexPopulator.add(NativeIndexPopulator.java:164)
    at org.neo4j.kernel.impl.index.schema.WorkSyncedNativeIndexPopulator$IndexUpdateApply.process(WorkSyncedNativeIndexPopulator.java:144)
    at org.neo4j.kernel.impl.index.schema.WorkSyncedNativeIndexPopulator$IndexUpdateWork.apply(WorkSyncedNativeIndexPopulator.java:168)
    at org.neo4j.kernel.impl.index.schema.WorkSyncedNativeIndexPopulator$IndexUpdateWork.apply(WorkSyncedNativeIndexPopulator.java:148)
    at org.neo4j.util.concurrent.WorkSync.doSynchronizedWork(WorkSync.java:231)
    at org.neo4j.util.concurrent.WorkSync.tryDoWork(WorkSync.java:157)
    at org.neo4j.util.concurrent.WorkSync.apply(WorkSync.java:91)
    at org.neo4j.kernel.impl.index.schema.WorkSyncedNativeIndexPopulator.add(WorkSyncedNativeIndexPopulator.java:81)
    ... 5 more

==================, reference 40308cf1-008c-4580-a7d4-19610e3a712d.

我根据消息删除了索引。

如何删除有问题的节点以使索引正常工作?
如何获取有问题的节点ID?

1 个答案:

答案 0 :(得分:0)

您可以检查不同数据类型here的大小限制。

一旦确定您的数据类型允许的最大大小(说MAX_SIZE = 4036,请在上面的链接上进行确认)。 您可以使用以下查询找到所有有问题的节点:

 MATCH (n:Temporal_Event) WHERE size(n.name) > MAX_SIZE RETURN n.id LIMIT 10

您可以删除这些节点,也可以只删除所需的属性。

如果要删除这些节点,请使用以下查询

MATCH (n:Temporal_Event) WHERE size(n.name) > MAX_SIZE DETACH DELETE n

此查询首先删除这些节点的所有关系(DETACH),然后删除节点(DELETE)。

有一些解决方法,我没有尝试过,但是您可以检查this answer