索引创建成功,但不会重新索引新数据

Index created successfully, but won't reindex new data

我完全被迷惑了,因为这段代码以前是有效的。

我正在尝试在我的图表 (trxn_dt_int) 中的边 属性 上创建混合边索引。

根据 mgmt.printSchema() 的输出显示它已成功创建(请参阅状态:Enabled,我已突出显示相关行)。

mgmt.printSchema() 输出:

==>------------------------------------------------------------------------------------------------
Vertex Label Name              | Partitioned | Static                                             |
---------------------------------------------------------------------------------------------------
entity                         | false       | false                                              |
---------------------------------------------------------------------------------------------------
Edge Label Name                | Directed    | Unidirected | Multiplicity                         |
---------------------------------------------------------------------------------------------------
transacts_with                 | true        | false       | MULTI                                |
---------------------------------------------------------------------------------------------------
Property Key Name              | Cardinality | Data Type                                          |
---------------------------------------------------------------------------------------------------
benef_nm                       | SINGLE      | class java.lang.String                             |
orig_nm                        | SINGLE      | class java.lang.String                             |
trxn_dt_int                    | SINGLE      | class java.lang.Float                              |
---------------------------------------------------------------------------------------------------
Vertex Index Name              | Type        | Unique    | Backing        | Key:           Status |
---------------------------------------------------------------------------------------------------
***************************************************************************************************

Edge Index (VCI) Name          | Type        | Unique    | Backing        | Key:           Status |
---------------------------------------------------------------------------------------------------
byDate                         | Mixed       | false     | search         | trxn_dt_int:   ENABLED|

***************************************************************************************************
---------------------------------------------------------------------------------------------------
Relation Index                 | Type        | Direction | Sort Key       | Order    |     Status |

这是我创建索引的 groovy 脚本:

graph.tx().rollback() 
mgmt = graph.openManagement()
mgmt.printSchema()

// get index count
index_count = mgmt.getGraphIndexes(Edge.class).size()

if (index_count==0) {

    // create edge schema for graph (only for properties to be indexed)
    if (!mgmt.getEdgeLabel('transacts_with') & !mgmt.getPropertyKey('trxn_dt_int')) {
        transacts_with = mgmt.makeEdgeLabel('transacts_with').make()
        trxn_dt = mgmt.makePropertyKey('trxn_dt_int').dataType(Float.class).make()
        mgmt.addProperties(transacts_with, trxn_dt)
    }
    mgmt.commit()

    mgmt = graph.openManagement()
    if (!mgmt.containsGraphIndex("byDate")) {
        trxn_dt = mgmt.getPropertyKey('trxn_dt_int')

        mgmt.buildIndex('byDate', Edge.class).addKey(trxn_dt).buildMixedIndex('search')

        mgmt.commit()

        ManagementSystem.awaitGraphIndexStatus(graph, 'byDate').call()

        mgmt = graph.openManagement()
        mgmt.updateIndex(mgmt.getGraphIndex("byDate"), SchemaAction.REINDEX).get()
        mgmt.commit()
    }
}

当我查询 elasticsearch 服务器时,它显示它在那里:

curl --silent 'http://127.0.0.1:9200/_cat/indices' | cut -d\  -f3
> janusgraph_bydate

当我查询文档数量时,它returns 0.

curl --silent 'http://127.0.0.1:9200/janusgraph_bydate/_count?q=*'
> {"count":0,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0}}

我的问题是,为什么没有添加任何文件?

我最初以为我必须重新索引,但当我尝试时,它仍然不起作用。完全没有错误。

mgmt = graph.openManagement()
index = mgmt.getGraphIndex('byDate')
mgmt.updateIndex(index, SchemaAction.REINDEX).get()
mgmt.commit()

设置:

嗯,这很尴尬;它没有用新数据更新索引,因为我的机器内存不足,但也没有提供警告来提示这一点。在其他地方释放内存后,它现在又可以工作了。