# Strange query result with the Polish analyzer

**URL:** <https://discuss.elastic.co/t/strange-query-result-with-the-polish-analyzer/28300>\
**Category:** Elasticsearch\
**Created:** [August 30, 2015, 5:50am UTC](https://discuss.elastic.co/t/strange-query-result-with-the-polish-analyzer/28300 "2015-08-30T05:50:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![drippel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drippel/32/44823_2.png) [@drippel](https://discuss.elastic.co/u/drippel)\
**Post date:** [August 30, 2015, 5:50am UTC](https://discuss.elastic.co/t/strange-query-result-with-the-polish-analyzer/28300/1 "2015-08-30T05:50:52Z")

</div>

I got a strange query result with the Polish analyzer ([Stempel (Polish) Analysis plugin](http://https%20:%20//github.com/elasticsearch/elasticsearch-analysis-stempel))

Here is the issue :

Use the Polish analyzer to index a document that contains in one of the fields the text "SIERPOWY Baton Energia #girl weganskie cudo #girl" :

```
{
	"_index" : "fts-polish",
	"_type" : "Document",
	"_id" : "bool3",
	"_source" : {
		"_analyzer" : "polish",
		"message" : "SIERPOWY 7:19 Baton Energia #girl weganskie cudo #girl"
	}
}

```

Run the following query :

```
{
	"from" : 0,
	"size" : 50,
	"query" : {
		"bool" : {
			"should" : [{
					"match" : {
						"_all" : {
							"query" : "value",
							"type" : "boolean"
						}
					}
				}
			]
		}
	},
	"highlight" : {
		"pre_tags" : [
			"<b>"
		],
		"post_tags" : [
			"</b>"
		],
		"fragment_size" : 0,
		"number_of_fragments" : 0,
		"fields" : {
			"*" : {}
		}
	}
}

```

You expect not to find anything, because the word "value" is not in the text, but you get the record that you indexed above, with the word "girl" highlighted :

```
{
	"took" : 11,
	"timed_out" : false,
	"_shards" : {
		"total" : 170,
		"successful" : 165,
		"failed" : 0
	},
	"hits" : {
		"total" : 1,
		"max_score" : 0.13561106,
		"hits" : [{
				"_index" : "fts-polish",
				"_type" : "Document",
				"_id" : "bool2",
				"_score" : 0.13561106,
				"_source" : {
					"_analyzer" : "polish",
					"streamId" : 1,
					"language" : "Polish",
					"message" : "SIERPOWY Baton Energia #girl weganskie cudo #girl"
				},
				"highlight" : {
					"message" : [
						"SIERPOWY Baton Energia #<b>girl</b> weganskie cudo #<b>girl</b>"
					]
				}
			}
		]
	}
}

```

Any ideas?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [September 1, 2015, 4:12pm UTC](https://discuss.elastic.co/t/strange-query-result-with-the-polish-analyzer/28300/2 "2015-09-01T16:12:14Z")

</div>

Both `girl` and `value` are translated into the same token `ć`:

```
curl "localhost:9200/_analyze?analyzer=polish&pretty" -d "girl" 
{
  "tokens" : [ {
    "token" : "ć",
    "start_offset" : 0,
    "end_offset" : 4,
    "type" : "<ALPHANUM>",
    "position" : 1
  } ]

curl "localhost:9200/_analyze?analyzer=polish&pretty" -d "value"    
{
  "tokens" : [ {
    "token" : "ć",
    "start_offset" : 0,
    "end_offset" : 5,
    "type" : "<ALPHANUM>",
    "position" : 1
  } ]
}

```

It looks like it's another variation of [https://github.com/elastic/elasticsearch-analysis-stempel/issues/31](https://github.com/elastic/elasticsearch-analysis-stempel/issues/31)

---

<div class="post-metadata">

**Author:** ![drippel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drippel/32/44823_2.png) [@drippel](https://discuss.elastic.co/u/drippel)\
**Post date:** [September 2, 2015, 5:11am UTC](https://discuss.elastic.co/t/strange-query-result-with-the-polish-analyzer/28300/3 "2015-09-02T05:11:01Z")

</div>

Thank you, Igor.  
I received a similar answer on github: [strange query result](https://github.com/elastic/elasticsearch-analysis-stempel/issues/44#event-396505560)

---

<div class="post-metadata">

**Author:** ![jw404](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@jw404](https://discuss.elastic.co/u/jw404)\
**Post date:** [April 19, 2016, 1:19pm UTC](https://discuss.elastic.co/t/strange-query-result-with-the-polish-analyzer/28300/4 "2016-04-19T13:19:15Z")

</div>

@drippel Did you managed to find solution? I have the same problem, but both pasted links are dead now.

---

<div class="post-metadata">

**Author:** ![drippel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drippel/32/44823_2.png) [@drippel](https://discuss.elastic.co/u/drippel)\
**Post date:** [May 2, 2016, 7:56am UTC](https://discuss.elastic.co/t/strange-query-result-with-the-polish-analyzer/28300/5 "2016-05-02T07:56:05Z")

</div>

@jw404: There seems to be no solution. This looks like an inherent limitation of the plugin.

---

<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 5, 2017, 10:54pm UTC](https://discuss.elastic.co/t/strange-query-result-with-the-polish-analyzer/28300/6 "2017-07-05T22:54:50Z")

</div>


