# How to get termvectors when using ingest plugin in ElasticSearch 5.5?

**URL:** <https://discuss.elastic.co/t/how-to-get-termvectors-when-using-ingest-plugin-in-elasticsearch-5-5/100260>\
**Category:** Elasticsearch\
**Created:** [September 12, 2017, 10:20pm UTC](https://discuss.elastic.co/t/how-to-get-termvectors-when-using-ingest-plugin-in-elasticsearch-5-5/100260 "2017-09-12T22:20:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sramalin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sramalin/32/25821_2.png) [@sramalin](https://discuss.elastic.co/u/sramalin)\
**Post date:** [September 12, 2017, 10:20pm UTC](https://discuss.elastic.co/t/how-to-get-termvectors-when-using-ingest-plugin-in-elasticsearch-5-5/100260/1 "2017-09-12T22:20:17Z")

</div>

All,

I have the following code to index a file using ingest plugin in elasticsearch

```
public class Document
{
  public string Id { get; set; }
  public string Content { get; set; }
  public Attachment Attachment { get; set; }
}

var indexResponse = client.CreateIndex("documents", c => c
  .Settings(s => s
    .Analysis(a => a
     .TokenFilters(f=>f.Stemmer("english_stem",st=>st.Language("english")).Stop("english_stop",sp=>sp.StopWords("_english_")))
     .CharFilters(cf => cf.PatternReplace("num_filter", nf => nf.Pattern("(\\d+)").Replacement(" ")))				 
     .Analyzers(an => an.Custom("tm_analyzer", ta => ta.CharFilters("num_filter").Tokenizer("standard").Filters("english_stem","english_stop","lowercase")))))
  .Mappings(m => m
    .Map<Document>(mp => mp
      .AllField(all => all
        .Enabled(false)
      )
      .Properties(ps => ps        
        .Text(s => s
          .Name(n => n.Content)
          .TermVector(TermVectorOption.Yes)
          .Store(true)				 
          .Analyzer("tm_analyzer")))));

client.PutPipeline("attachments", p => p
  .Description("Document attachment pipeline")
  .Processors(pr => pr
    .Attachment<Document>(a => a
      .Field(f => f.Content)
      .TargetField(f => f.Attachment)
    )
    .Remove<Document>(r => r
      .Field(f => f.Content)
    )
  )
);

var base64File = Convert.ToBase64String(File.ReadAllBytes("file1.xml"));
client.Index(new Document
{
  Id = file1.xml, 
  Content = base64File
}, i => i.Pipeline("attachments"));

```

As you can see i have set the termvector otpion to yes on the Content field.  
But when i query like below using postman or in C# Nest i get nothing

```
POST /documents/document/_mtermvectors
{
    "ids" : ["1.xml"],
    "parameters": {
        "fields": [
                "content"
        ],
        "term_statistics": true
    }
}

```

Any ideas what I am doing wrong? Thanks for the help!

---

<div class="post-metadata">

**Author:** ![sramalin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sramalin/32/25821_2.png) [@sramalin](https://discuss.elastic.co/u/sramalin)\
**Post date:** [September 13, 2017, 5:06am UTC](https://discuss.elastic.co/t/how-to-get-termvectors-when-using-ingest-plugin-in-elasticsearch-5-5/100260/2 "2017-09-13T05:06:22Z")

</div>

Answered here

> <https://stackoverflow.com/questions/46186121/how-to-get-termvectors-when-using-ingest-plugin-in-elasticsearch-5-5>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 11, 2017, 5:06am UTC](https://discuss.elastic.co/t/how-to-get-termvectors-when-using-ingest-plugin-in-elasticsearch-5-5/100260/3 "2017-10-11T05:06:50Z")

</div>

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