# The Porter Stemming Filter

**URL:** <https://discuss.elastic.co/t/the-porter-stemming-filter/2933>\
**Category:** Elasticsearch\
**Created:** [April 30, 2010, 11:05am UTC](https://discuss.elastic.co/t/the-porter-stemming-filter/2933 "2010-04-30T11:05:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jude](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@Jude](https://discuss.elastic.co/u/Jude)\
**Post date:** [April 30, 2010, 11:05am UTC](https://discuss.elastic.co/t/the-porter-stemming-filter/2933/1 "2010-04-30T11:05:26Z")

</div>

Hi,

I'm having trouble getting the porterStem filter working - using this  
filter I'd expect to find a document titled "testing stemming rules"  
when searching for "stem" or "rule", but that doesn't seem to be  
happening...

A transcript illustrating the problem follows, I've tried this using  
both 0.6.0 and 0.7.0 built from today's source.

[jude@s2 elasticsearch]$ curl -XPUT localhost:9200/example.com -  
d'index :

> ```
> analysis :
> analyzer :
> stemming :
> type : custom
> tokenizer : standard
> filter : [standard, lowercase, stop, porterStem]
> 
> ```
> 
> '  
> {"ok":true,"acknowledged":true}

[jude@s2 elasticsearch]$ curl -XPUT localhost:9200/example.com/doc/  
\_mapping -d'{"properties": { "title" : { "analyzer" : "stemming",  
"type" : "string" }}}'  
{"ok":true,"acknowledged":true}

[jude@s2 elasticsearch]$ curl -XPUT localhost:9200/example.com/doc/  
test -d'{"title": "testing stemming rules"}'  
{"ok":true,"\_index":"[example.com](http://example.com)","\_type":"doc","\_id":"test"}

[jude@s2 elasticsearch]$ curl -XGET 127.0.0.1:9200/example.com/\_search  
-d'{"query":{"query\_string":{"query":"stem"}}}'  
{"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":  
0,"hits":}}

[jude@s2 elasticsearch]$ curl -XGET 127.0.0.1:9200/example.com/\_search  
-d'{"query":{"query\_string":{"query":"rule"}}}'  
{"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":  
0,"hits":}}

A status query shows that my custom analyzer has been registered, and  
I've set the title property analyzer to "stemming", so I can't see why  
it's not being used:

[www@S2 elasticsearch]$ curl -XGET 127.0.0.1:9200/getrevising.co.uk/  
\_status?pretty=true  
{  
"ok" : true,  
"\_shards" : {  
"total" : 10,  
"successful" : 5,  
"failed" : 0  
},  
"indices" : {  
"[getrevising.co.uk](http://getrevising.co.uk)" : {  
"aliases" : ,  
"settings" : {  
"index.analysis.analyzer.stemming.type" : "custom",  
"index.analysis.analyzer.stemming.tokenizer" : "standard",  
"index.analysis.analyzer.stemming.filter.1" : "lowercase",  
"index.analysis.analyzer.stemming.filter.0" : "standard",  
"index.analysis.analyzer.stemming.filter.3" : "porterStem",  
"index.analysis.analyzer.stemming.filter.2" : "stop",  
"index.number\_of\_shards" : "5",  
"index.number\_of\_replicas" : "1"  
},  
[...snip...]

I think I must be missing something obvious, could anyone point me in  
the right direction please?

Cheers,  
Jude

--

> **[Cuttlefish](https://cuttlefish.com/)**
>
> Cuttlefish is a web, app and design company based in Loughborough. We build content managed websites, mobile apps, and offer digital design and print services.

---

<div class="post-metadata">

**Author:** ![Jude](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@Jude](https://discuss.elastic.co/u/Jude)\
**Post date:** [May 6, 2010, 2:48pm UTC](https://discuss.elastic.co/t/the-porter-stemming-filter/2933/2 "2010-05-06T14:48:15Z")

</div>

Hi guys,

Sorry to repost but I still have no success with the porterStem  
filter, does anyone else use it?

I can't see what I'm doing wrong here, ES seems perfect except for  
this one thing. I could instead stem my text before indexing it, but  
I'd rather let ES do it itself if it can.

Transcript follows, have tested this against 0.6.0 and a build freshly  
pulled from github. I'm happy to create a new issue on github if this  
is a bug.

Thanks,  
Jude

[jude@s2]$ curl -XPUT localhost:9200/example.com -d'index :

> ```
> analysis :
> analyzer :
> stemming :
> type : custom
> tokenizer : standard
> filter : [standard, lowercase, porterStem, stop]
> 
> ```
> 
> '  
> {"ok":true,"acknowledged":true}

[jude@s2]$ curl -XPUT localhost:9200/example.com/doc/\_mapping -  
d'{"properties": { "title" : { "index\_analyzer" : "stemming",  
"search\_analyzer" : "stemming", "type" : "string" }}}'  
{"ok":true,"acknowledged":true}

[jude@s2]$ curl -XPUT localhost:9200/example.com/doc/test -d'{"title":  
"testing stemming rules"}'  
{"ok":true,"\_index":"[example.com](http://example.com)","\_type":"doc","\_id":"test"}

[jude@s2]$ curl -XGET localhost:9200/example.com/\_search -d'{"query":  
{"query\_string":{"query":"stemming"}}}'  
{"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":  
1,"hits":[{"\_index":"[example.com](http://example.com)","\_type":"doc","\_id":"test3",  
"\_source" : {"title": "testing stemming rules"}}]}}

[jude@s2]$ curl -XGET localhost:9200/example.com/\_search -d'{"query":  
{"query\_string":{"query":"stem"}}}'  
{"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":  
0,"hits":}}

[jude@s2]$ curl -XGET localhost:9200/example.com/\_status?pretty=true  
{  
"ok" : true,  
"\_shards" : {  
"total" : 10,  
"successful" : 5,  
"failed" : 0  
},  
"indices" : {  
"[example.com](http://example.com)" : {  
"aliases" : ,  
"settings" : {  
"index.analysis.analyzer.stemming.type" : "custom",  
"index.analysis.analyzer.stemming.tokenizer" : "standard",  
"index.analysis.analyzer.stemming.filter.1" : "lowercase",  
"index.analysis.analyzer.stemming.filter.0" : "standard",  
"index.analysis.analyzer.stemming.filter.3" : "stop",  
"index.analysis.analyzer.stemming.filter.2" : "porterStem",  
"index.number\_of\_shards" : "5",  
"index.number\_of\_replicas" : "1"  
},  
...

---

<div class="post-metadata">

**Author:** ![hovo110](https://avatars.discourse-cdn.com/v4/letter/h/ecd19e/32.png) [@hovo110](https://discuss.elastic.co/u/hovo110)\
**Post date:** [August 6, 2010, 6:53am UTC](https://discuss.elastic.co/t/the-porter-stemming-filter/2933/3 "2010-08-06T06:53:56Z")

</div>

I have exactly same problem.

Also there is no any sample in [elasticsearch.com](http://elasticsearch.com) how to setup the stemming.

---

<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 6, 2017, 4:21am UTC](https://discuss.elastic.co/t/the-porter-stemming-filter/2933/4 "2017-07-06T04:21:05Z")

</div>


