Search code examples
scalaelasticsearchapache-sparkelasticsearch-hadoop

how to get term vectors by using Elasticsearch Hadoop


I'm using ElasticSearch-Hadoop API. And I was trying to get _mtermvector by using the following Spark code:

val query= """_mtermvectors {
        "ids" : ["1256"],
        "parameters": {
            "fields": [
                 "tname"
            ],
            "term_statistics": true
        }
}"""
var idRdd = sparkContext.esRDD("uindex/type1",query)

It didn't work, any ideas please, appreciate!


Solution

  • You can't use endpoints (like _mtermvectors) which are part of the document API's with ES-Hadoop. Only queries which belongs to the query API's, query DSL or external resource are allowed.

    Hope that it helps.