Skip to content

How to use the MultiTermVectorsAsync API #3219

Closed
@aelghoneimy

Description

@aelghoneimy

NEST/Elasticsearch.Net version: 6.0.2

Elasticsearch version: 6.2.3

Description of the problem including expected versus actual behavior:
I am trying to call the below query using NEST

GET 123_original/_doc/_mtermvectors
{
  "ids": [
    "9a271078-086f-4f4b-8ca0-16376c2f49a7",
    "481ce3db-69bf-4886-9c38-fcb878d44925"
  ],
  "parameters": {
    "fields": ["*"],
    "positions": false,
    "offsets": false,
    "payloads": false,
    "term_statistics": false,
    "field_statistics": false
  }
}

The NEST API (I think) would look something like this

var term = await elasticClient.MultiTermVectorsAsync(x =>
{
    return x.Index(indexOriginal)    // 123_original
        .Type(typeName)              // _doc
        .GetMany<ElasticDataSet>(ids.Keys) // list of strings
        .Fields("*")
        .FieldStatistics(false)
        .Positions(false)
        .Offsets(false)
        .TermStatistics(false)
        .Payloads(false);
});

The problem is that the above API is returning the following error
Index name is null for the given type and no default index is set. Map an index name using ConnectionSettings.DefaultMappingFor<TDocument>() or set a default index using ConnectionSettings.DefaultIndex().

And this is the query that its trying to execute which has the index in it and is missing the ids, but works in Kibana when the ids are set.
123_original/_doc/_mtermvectors?fields=%2A&field_statistics=false&positions=false&offsets=false&term_statistics=false&payloads=false

I cannot find a documentation on how to use the Multi Term Vector using NEST.

related Stackoverflow issue: https://stackoverflow.com/questions/50058822/how-to-use-multitermvectorsasync

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions