# How to stem, remove stop words from my index data?

**URL:** <https://discuss.elastic.co/t/how-to-stem-remove-stop-words-from-my-index-data/184501>\
**Category:** Elasticsearch\
**Created:** [June 6, 2019, 6:23am UTC](https://discuss.elastic.co/t/how-to-stem-remove-stop-words-from-my-index-data/184501 "2019-06-06T06:23:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![princesahu04](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/princesahu04/32/47235_2.png) [@princesahu04](https://discuss.elastic.co/u/princesahu04)\
**Post date:** [June 6, 2019, 6:23am UTC](https://discuss.elastic.co/t/how-to-stem-remove-stop-words-from-my-index-data/184501/1 "2019-06-06T06:23:45Z")

</div>

I want to stem, remove stop words from my index data (\_doc/1).  
My analyzer, mapping is:  
\> PUT my\_index

> ```
> {
> "settings": {
> "index":{
> "analysis":{
> "filter":{
> "synonym":{
> "type":"synonym",
> "synonyms_path":"C:/Users/ALMUG/Downloads/elasticsearch-7.1.0/config/synonym.txt"
> },
> "english_stop":{
> "type":"stop",
> "stopwords":"_english_"
> },
> "my_stemmer":{
> "type":"stemmer",
> "name":"english"
> }
> },
> "analyzer":{
> "my_custom_analyzer":{
> "type":"custom",
> "tokenizer":"standard",
> "filter":[
> "lowercase",
> "english_stop",
> "synonym",
> "my_stemmer"
> ]
> }
> }
> }
> }
> }, 
> "mappings": {
> "properties": {
> "container": {
> "type": "nested" ,
> "properties": {
> "heading": { "type": "text","boost": 2 },
> "para": { 
> "type": "text",
> "analyzer":"my_custom_analyzer"
> }
> }
> }
> }
> }
> }
> 
> ```

Below code is my indexing

> ```
> PUT my_index/_doc/1
> {
> "container" : [
> {
> "header" : "Limitation on incurrence of Indebtedness and issuance of Disqualified Stock and Preferred Stock",
> "para" : "The will Issuer prince not, and will not permit any of its Restricted Subsidiaries to, Incur however, that the and any Restricted Subsidiary may the Consolidated Fixed Charge Coverage Ratio for the most recently ended four fiscal quart"
> },
> {
> "header" : "Selection and notice",
> "para" : "If the debt covenant is redeeming or purchasing less than all of the Secured Notes issued under th"
> }
> ]
> }
> 
> ```

Now I want to perform \_analyze in \_doc/1

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 6, 2019, 6:39am UTC](https://discuss.elastic.co/t/how-to-stem-remove-stop-words-from-my-index-data/184501/2 "2019-06-06T06:39:46Z")

</div>

Welcome! 😉

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

> Now I want to perform `_analyze` in `_doc/1`

You can't really. But why do you want to do this?  
You can analyze the text that you sent within this document though to understand what happened behind the scene with:

```auto
GET my_index/_analyze
{
  "field" : "container.para",
  "text" : [ 
     "Issuer not, and will not permit any of its Restricted Subsidiaries to, the Consolidated Fixed Charge Coverage Ratio for the most recently end Indebtedness is Incurred is at least 2.0 to 1.0", 
     "If the debt covenant is redeeming or purchasing less than all of the Secured Notes issued under the Secured Indenture at any time." 
  ]
}

```

---

<div class="post-metadata">

**Author:** ![princesahu04](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/princesahu04/32/47235_2.png) [@princesahu04](https://discuss.elastic.co/u/princesahu04)\
**Post date:** [June 6, 2019, 7:35am UTC](https://discuss.elastic.co/t/how-to-stem-remove-stop-words-from-my-index-data/184501/3 "2019-06-06T07:35:07Z")

</div>

My objective is to remove stopwords, do stemming from `container.para` and then write a query to find any match from para like below

![image](https://us1.discourse-cdn.com/elastic/original/3X/1/6/16a116499cdcd009ca4e2be3a2d61ea1c39922dc.png)

`Container` contains alot of `heading` and `para`. I want to remove stopwords, perform stemming for all the text in`container`

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 6, 2019, 8:12am UTC](https://discuss.elastic.co/t/how-to-stem-remove-stop-words-from-my-index-data/184501/4 "2019-06-06T08:12:13Z")

</div>

Please don't post images of text as they are hardly readable and not searchable.

Instead paste the text and format it with `</>` icon. Check the preview window.

> [@princesahu04](#):
>
> My objective is to remove stopwords, do stemming from `container.para` and then write a query to find any match from para like below

You don't need to call `_analyze` API for this.

---

<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:** [July 4, 2019, 8:12am UTC](https://discuss.elastic.co/t/how-to-stem-remove-stop-words-from-my-index-data/184501/5 "2019-07-04T08:12:24Z")

</div>

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