All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.vertexium.elasticsearch.utils.ElasticsearchDocIdUtils Maven / Gradle / Ivy

There is a newer version: 3.0.4
Show newest version
package org.vertexium.elasticsearch.utils;

import org.elasticsearch.search.SearchHit;
import org.vertexium.VertexiumException;
import org.vertexium.elasticsearch.ElasticsearchDocumentType;

public class ElasticsearchDocIdUtils {
    public static Object fromSearchHit(SearchHit searchHit) {
        ElasticsearchDocumentType dt = ElasticsearchDocumentType.fromSearchHit(searchHit);
        if (dt == null) {
            return null;
        }
        switch (dt) {
            case EDGE:
            case VERTEX:
                return searchHit.getId();
            case EDGE_EXTENDED_DATA:
            case VERTEX_EXTENDED_DATA:
                return ElasticsearchExtendedDataIdUtils.fromSearchHit(searchHit);
            default:
                throw new VertexiumException("Unhandled document type: " + dt);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy