MultiTermVectorsRequest using .Net client nest


(siva ramalingam) #1

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?

Thanks for the help.


(siva ramalingam) #2

Answered here in case anyone is looking


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.