# Paging w/ multi\_match on edge ngram produces duplicate docs

**URL:** <https://discuss.elastic.co/t/paging-w-multi-match-on-edge-ngram-produces-duplicate-docs/71778>\
**Category:** Elasticsearch\
**Created:** [January 16, 2017, 7:17pm UTC](https://discuss.elastic.co/t/paging-w-multi-match-on-edge-ngram-produces-duplicate-docs/71778 "2017-01-16T19:17:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Doman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_doman/32/11409_2.png) [@Thomas\_Doman](https://discuss.elastic.co/u/Thomas_Doman)\
**Post date:** [January 16, 2017, 7:17pm UTC](https://discuss.elastic.co/t/paging-w-multi-match-on-edge-ngram-produces-duplicate-docs/71778/1 "2017-01-16T19:17:44Z")

</div>

We are currently using ES v1.7.5 on Windows in a .NET environment using NEST v1.7.2. I have discovered that trying to page on an edge ngram field will produce duplicate docs. I can see how an ngram could be tricky to page but this seem like a bug. Here's the operative part of my query:

```auto
"must": [{
   "multi_match": {
      "type": "best_fields",
      "query": "joe",
      "analyzer": "default",
      "fields": ["fullName",
                      "fullName.engram"]
      }
   }]

```

If I leave out the `.engram` field, it pages fine. Even if I **only** use the .`engram` field in the fields element it will yield duplicate docs. For the "fullName" field, our mapping uses a multi-field so, for completeness, here is the definition together w/ how we've defined the edge ngram.

```auto
"fullName": {
	"type": "string",
	"fields": {
		"engram": {
			"type": "string",
			"analyzer": "edge_ngram_analyzer"
		},
		...
		another custom analyzer of ours
	}
}

```

```auto
"filter": {
	"edge_ngram_filter": {
		"type": "edgeNGram",
		"min_gram": 2,
		"max_gram": 10
	}
},
"analyzer": {
	"edge_ngram_analyzer": {
		"type": "custom",
		"tokenizer": "icu_tokenizer",
		"filter": ["icu_normalizer",
		"icu_folding",
		"edge_ngram_filter"],
		"char_filter": ["html_strip"]
	}
}

```

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 30, 2017, 1:01pm UTC](https://discuss.elastic.co/t/paging-w-multi-match-on-edge-ngram-produces-duplicate-docs/71778/2 "2017-01-30T13:01:35Z")

</div>

Hi @Thomas_Doman

I think what you're seeing is "bouncing results" - documents in different shards are stored in different segments, which means that the scores are slightly different. If you use `?preference=$session_id` or something similar to ensure that the same user always hits the same shard copy, this behaviour should disappear.

---

<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:** [February 27, 2017, 1:02pm UTC](https://discuss.elastic.co/t/paging-w-multi-match-on-edge-ngram-produces-duplicate-docs/71778/3 "2017-02-27T13:02:09Z")

</div>

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