# Top 10 doc of a User get changed when i insert data in another user's space

**URL:** <https://discuss.elastic.co/t/top-10-doc-of-a-user-get-changed-when-i-insert-data-in-another-users-space/238939>\
**Category:** Elasticsearch\
**Created:** [June 27, 2020, 9:53am UTC](https://discuss.elastic.co/t/top-10-doc-of-a-user-get-changed-when-i-insert-data-in-another-users-space/238939 "2020-06-27T09:53:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RAHUL\_PATEL](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_patel/32/71230_2.png) [@RAHUL\_PATEL](https://discuss.elastic.co/u/RAHUL_PATEL)\
**Post date:** [June 27, 2020, 9:53am UTC](https://discuss.elastic.co/t/top-10-doc-of-a-user-get-changed-when-i-insert-data-in-another-users-space/238939/1 "2020-06-27T09:53:12Z")

</div>

Problem Statement:

1. I have 1000 users in my index
2. when I use this query

```auto
 {
     "query": {
       "bool": {
         "must": [
           {
             "match": {
               "keywords": {
                 "query": "hdfc",
                 "operator": "OR",
                 "prefix_length": 0,
                 "max_expansions": 50,
                 "fuzzy_transpositions": true,
                 "lenient": false,
                 "zero_terms_query": "NONE",
                 "auto_generate_synonyms_phrase_query": true,
                 "boost": 1.0
               }
             }
           },
           {
             "match": {
               "keywords": {
                 "query": "2018-19",
                 "operator": "OR",
                 "prefix_length": 0,
                 "max_expansions": 50,
                 "fuzzy_transpositions": true,
                 "lenient": false,
                 "zero_terms_query": "NONE",
                 "auto_generate_synonyms_phrase_query": true,
                 "boost": 1.0
               }
             }
           },
           {
             "match": {
               "userId": {
                 "query": "test2345",
                 "operator": "OR",
                 "prefix_length": 0,
                 "max_expansions": 50,
                 "fuzzy_transpositions": true,
                 "lenient": false,
                 "zero_terms_query": "NONE",
                 "auto_generate_synonyms_phrase_query": true,
                 "boost": 1.0
               }
             }
           }
         ],
         "should": [
           {
             "match": {
               "keywords": {
                 "query": "profits",
                 "operator": "OR",
                 "prefix_length": 0,
                 "max_expansions": 50,
                 "fuzzy_transpositions": true,
                 "lenient": false,
                 "zero_terms_query": "NONE",
                 "auto_generate_synonyms_phrase_query": true,
                 "boost": 1.0
               }
             }
           }
         ],
         "adjust_pure_negative": true,
         "minimum_should_match": "0",
         "boost": 1.0
       }
     }
   }

```

then I got top 10 results.  
3. After the 2nd step, we add data to other users space.  
4. if we are hitting the same query again then our top 10 get changed

can you please help me on this?

---

<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 27, 2020, 12:23pm UTC](https://discuss.elastic.co/t/top-10-doc-of-a-user-get-changed-when-i-insert-data-in-another-users-space/238939/2 "2020-06-27T12:23:55Z")

</div>

Welcome!

If you want to have consistent results whatever is indexed in the meantime, you probably need to use the scroll API. But you will have to keep the first data that has been retrieved so far in your application most likely.

---

<div class="post-metadata">

**Author:** ![RAHUL\_PATEL](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_patel/32/71230_2.png) [@RAHUL\_PATEL](https://discuss.elastic.co/u/RAHUL_PATEL)\
**Post date:** [June 27, 2020, 2:38pm UTC](https://discuss.elastic.co/t/top-10-doc-of-a-user-get-changed-when-i-insert-data-in-another-users-space/238939/3 "2020-06-27T14:38:00Z")

</div>

Actually , i have not added data in given user so top 10 docs should not changes. score should consistent for this user for a given query.

---

<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 27, 2020, 10:00pm UTC](https://discuss.elastic.co/t/top-10-doc-of-a-user-get-changed-when-i-insert-data-in-another-users-space/238939/4 "2020-06-27T22:00:05Z")

</div>

What is the problem? Could you share the result?

---

<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 25, 2020, 10:00pm UTC](https://discuss.elastic.co/t/top-10-doc-of-a-user-get-changed-when-i-insert-data-in-another-users-space/238939/5 "2020-07-25T22:00:10Z")

</div>

Closed on July 25, 2020, 10:00pm UTC

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