# Type order in multi-type query affects query results?

**URL:** <https://discuss.elastic.co/t/type-order-in-multi-type-query-affects-query-results/37397>\
**Category:** Elasticsearch\
**Created:** [December 16, 2015, 7:35pm UTC](https://discuss.elastic.co/t/type-order-in-multi-type-query-affects-query-results/37397 "2015-12-16T19:35:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abk/32/6143_2.png) [@abk](https://discuss.elastic.co/u/abk)\
**Post date:** [December 16, 2015, 7:35pm UTC](https://discuss.elastic.co/t/type-order-in-multi-type-query-affects-query-results/37397/1 "2015-12-16T19:35:01Z")

</div>

I'm running ES 1.7.1 on found, accessing it via the Java client (1.7.1).

I've found that the order of the types I define in the query changes the results. For instance, if I use types 'a,b,c', I get different results from 'b,c,a'. E.g.

This is the query I used:

```auto
{
  "from" : 0,
  "size" : 28,
  "query" : {
    "filtered" : {
          "query" : {
            "bool" : {
              "should" : {
                "multi_match" : {
                  "query" : "alan",
                  "fields" : ["name^2", "nickName^2", "role^1.5", "localization"],
                  "fuzziness" : "AUTO"
                }
              }
            }
          },
          "filter" : {
            "bool" : {
              "must" : [ {
                "type" : {
                  "value" : "person"
                }
              }, {
                "range" : {
                  "createdOn" : {
                    "from" : null,
                    "to" : 1450291614644,
                    "include_lower" : true,
                    "include_upper" : true
                  }
                }
              }, {
                "missing" : {
                  "field" : "deletedOn"
                }
              } ]
            }
          }
        }     
  }
}

```

If I run `GET ciandt-com/person,linkPost,post/_search`, I get one result, as expected:

```auto
{
   "took": 1,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 4.6976204,
      "hits": [
         {
            "_index": "ciandt-com-20151216183428244",
            "_type": "person",
            "_id": "635181261",
            "_score": 4.6976204,
            "_source": {
               "type": "person",
               "avatar": {
                  "url": "https://lh5.googleusercontent.com/-qpD-rFV18pA/AAAAAAAAAAI/AAAAAAAAAr8/ZbnMNmGxH8w/photo.jpg"
               },
               "cover": {
                  "url": "https://lh5.googleusercontent.com/-qpD-rFV18pA/AAAAAAAAAAI/AAAAAAAAAr8/ZbnMNmGxH8w/photo.jpg"
               },
               "createdOn": "2015-12-16T18:04:34.173Z",
               "email": "alanbk@ciandt.com",
               "hashtags": [],
               "id": 635181261,
               "name": "Alan Kleiman",
               "nickName": "mars",
               "phone": "",
               "title": "Alan Kleiman",
               "universalId": "PersonProfile:alanbk@ciandt.com"
            }
         }
      ]
   }
}

```

But if I run `GET ciandt-com/linkPost,person,post/_search`:

```auto
{
   "took": 1,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 0,
      "max_score": null,
      "hits": []
   }
}

```

Am I missing something here?

Edit: Fussing with the query some more, I removed the type query, and this behavior disappeared. Should I just not use the type query?

---

<div class="post-metadata">

**Author:** ![Ramdev\_Wudali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramdev_wudali/32/7894_2.png) [@Ramdev\_Wudali](https://discuss.elastic.co/u/Ramdev_Wudali)\
**Post date:** [July 28, 2016, 7:49pm UTC](https://discuss.elastic.co/t/type-order-in-multi-type-query-affects-query-results/37397/2 "2016-07-28T19:49:34Z")

</div>

was there any resolution to this question ?

Thanks

Ramdev

---

<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:32pm UTC](https://discuss.elastic.co/t/type-order-in-multi-type-query-affects-query-results/37397/3 "2017-07-05T22:32:00Z")

</div>


