JanusGraph / janusgraph

JanusGraph: an open-source, distributed graph database
https://janusgraph.org
Other
5.3k stars 1.17k forks source link

Could not register new index field with index backend #851

Open boliza opened 6 years ago

boliza commented 6 years ago

Configuration:

gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=cql
index.search.backend=elasticsearch
index.search.hostname=127.0.0.1
index.search.elasticsearch.use-all-field=false
index.search.elasticsearch.create.use-external-mappings=true

Env:

  1. cassandra 3.10
  2. elasticsearch 5.4.2
  3. janusgraph 0.3.0-SNAPSHOT
gremlin> graph = JanusGraphFactory.open('conf/janusgraph-cql-es.properties')
==>standardjanusgraph[cql:[127.0.0.1]]
gremlin> GraphOfTheGodsFactory.load(graph)
Could not register new index field with index backend
Type ':help' or ':h' for help.
Display stack trace? [yN]y
org.janusgraph.core.JanusGraphException: Could not register new index field with index backend
boliza commented 6 years ago

link #805

if (useExternalMappings) {
    try {
        //We check if the externalMapping have the property 'key'
        final IndexMapping mappings = client.getMapping(indexStoreName, store);
        if (mappings == null || (!mappings.isDynamic() && !mappings.getProperties().containsKey(key))) {
            //Error if it is not dynamic and have not the property 'key'
            throw new PermanentBackendException("The external mapping for index '"+ indexStoreName
                    + "' and type '" + store + "' do not have property '" + key + "'");
        } else if (mappings.isDynamic()) {
            //If it is dynamic, we push the unknown property 'key'
            this.pushMapping(store, key, information);
        }
    } catch (final IOException e) {
        throw new PermanentBackendException(e);
    }
}

if useExternalMappings is true will first to get Mapping, so will produce

Caused by: org.elasticsearch.client.ResponseException: method [GET], host [http://127.0.0.1:9200], URI [/janusgraph_vertices/_mapping/vertices], status line [HTTP/1.1 404 Not Found]
{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"janusgraph_vertices","index_uuid":"_na_","index":"janusgraph_vertices"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"janusgraph_vertices","index_uuid":"_na_","index":"janusgraph_vertices"},"status":404}
davidclement90 commented 6 years ago

Ok the error is not explicit, because the error is not well catch. But then you use external mapping you should push you index first in ES. Use-external-mapping should be used when you want to customized your ES mapping.

boliza commented 6 years ago

OK. Close this after add more document to explain this?

Qsimple commented 6 years ago

I got the same exception and can't find the solution even after reading your issue carefully. Could you give some more details? Thinks

yancoo commented 3 years ago

Oh... The same problem has bothered me for a long time. My conf properties file was following:

index.search.index-name=test_IMPORT

When I executed run.sh by janusgraph-utils , i got :

parse GSON failed: Could not register new index field with index backend

After repeated retries, I found that the problem lies in the index name, and uppercase letters cannot be used. When I modify index.search.index-name=test_import, everything is ok.