'MultiTermVectorsRequest using .Net client nest

All, From the docs here https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html i see there are multiple ways to make the request.

I can do the POST /_mtermvectors as

MultiTermVectorsRequest tvr = new MultiTermVectorsRequest()
{               
    Documents = Enumerable.Range(1,2).Select(n => new MultiTermVectorOperation<Tweet>(n)
    {
        StoredFields = new [] {"message"}, 
        Index = "twitter",
        FieldStatistics = false,
        TermStatistics = true,
        Positions = false,
        Offsets = false
    })
};

and it looks like

{
  "docs": [
    {
      "_index": "twitter",
      "_type": "tweet",
      "_id": 1,
      "fields": [
        "message"
      ],
      "offsets": false,
      "positions": false,
      "term_statistics": true,
      "field_statistics": false
    },
    {
      "_index": "twitter",
      "_type": "tweet",
      "_id": 2,
      "fields": [
        "message"
      ],
      "offsets": false,
      "positions": false,
      "term_statistics": true,
      "field_statistics": false
    }
  ]
}

My question is how do i change the request to POST /twitter/tweet/_mtermvectors so it looks like

{
    "ids" : ["1", "2"],
    "parameters": {
        "fields": [
                "message"
        ],
        "term_statistics": true
    }
}

I want it to be a single request with the ids specified as a string array in order to reduce the size of the request. Also how can i add filter like min_doc_frequency to this request?



Solution 1:[1]

The format including "ids" and "parameters" is not supported in the high level client. It's possible to send it with the low level client though and return back a high level response

var response = client.LowLevel.Mtermvectors<MultiTermVectorsResponse>(
    "twitter", 
    "tweet", 
    new 
    {
        ids = new [] { "1", "2" },
        parameters = new 
        {
            fields = new [] { "message" },
            term_statistics = true
        }
    });

var highLevelResponse = response.Body;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Russ Cam