# Query es 2.3 to es 5.5

**URL:** <https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618>\
**Category:** Elasticsearch\
**Created:** [December 13, 2017, 5:48pm UTC](https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618 "2017-12-13T17:48:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![piyush](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@piyush](https://discuss.elastic.co/u/piyush)\
**Post date:** [December 13, 2017, 5:48pm UTC](https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618/1 "2017-12-13T17:48:47Z")

</div>

Hi,  
Below is ES-2.3 query which returns 2 records but same query is returning all index records (documents). What could be causing this behavior?

1. Index schema is same in both versions (2.3 and 5.5) [so analyzer are same]
2. If filter clause is not supported in es-5.5, i was expecting this query should throw error. but query executes just fine, it returns all rows though.
3. plane bool query to search these two products also returns all records, instead it should return only two values.

```auto
get test-index/_search
{
  "_source": [],
  "query": {
    "filtered": {
      "query": {
        "bool": {
          "should": [
            {
              "term": {
                "_id": "product123"
              }
            },
            {
              "term": {
                "_id": "product456"
              }
            }
          ]
        }
      }
    }
  },
  "post_filter": {
    "bool": {
      "must": []
    }
  },
  "sort": [
    {
      "priority": {
        "order": "asc"
      }
    }
  ],
  "size": 100,
  "from": 0,
  "aggs": {
    "filtered": {
      "filter": {
        "bool": {
          "must": []
        }
      },
      "aggs": {
        "brand": {
          "terms": {
            "field": "manufacturer",
            "size": 1000
          }
        },
        "model": {
          "terms": {
            "field": "model",
            "size": 1000
          }
        },
        "searchableColor": {
          "terms": {
            "field": "searchableColors",
            "size": 1000
          }
        },
        "averageRating": {
          "terms": {
            "field": "rating",
            "size": 1000
          }
        },
        "dealBadge": {
          "terms": {
            "field": "dealBadge",
            "size": 1000
          }
        },
        "conditions": {
          "terms": {
            "field": "conditions",
            "size": 1000
          }
        }
      }
    }
  }
}

```

Thanks....

---

<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:** [December 13, 2017, 8:14pm UTC](https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618/2 "2017-12-13T20:14:28Z")

</div>

What is the tool you are using to send the requests?

Note that Kibana Dev Console requires `GET` and not `get`. You should see a red cross just close to it if it's wrong IIRC.

---

<div class="post-metadata">

**Author:** ![piyush](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@piyush](https://discuss.elastic.co/u/piyush)\
**Post date:** [December 13, 2017, 8:36pm UTC](https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618/3 "2017-12-13T20:36:12Z")

</div>

I am using Kibana Dev Console. and "get" and "GEt" both are working (i.e. returning all index data) but "GET" in throwing below error:

{  
"error": {  
"root\_cause": [  
{  
"type": "parsing\_exception",  
"reason": "no [query] registered for [filtered]",  
"line": 4,  
"col": 17  
}  
],  
"type": "parsing\_exception",  
"reason": "no [query] registered for [filtered]",  
"line": 4,  
"col": 17  
},  
"status": 400  
}

---

<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:** [December 13, 2017, 8:43pm UTC](https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618/4 "2017-12-13T20:43:59Z")

</div>

That's what I meant.

`get` ignores basically the body.  
`GET` is the right syntax.

It tells you that you are using an API that has been removed.  
You need to fix it.

And please format your code using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

I edited your first post to make it readable but please format your next questions.

---

<div class="post-metadata">

**Author:** ![piyush](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@piyush](https://discuss.elastic.co/u/piyush)\
**Post date:** [December 13, 2017, 8:48pm UTC](https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618/5 "2017-12-13T20:48:41Z")

</div>

sure, thanks...

It was formatted in Kibana dev console, so i assume it should be fine. But got it 🙂 :

```
{
  "error": {
"root_cause": [
  {
    "type": "parsing_exception",
    "reason": "no [query] registered for [filtered]",
    "line": 4,
    "col": 17
  }
],
"type": "parsing_exception",
"reason": "no [query] registered for [filtered]",
"line": 4,
"col": 17
  },
  "status": 400
}
```

---

<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:** [December 13, 2017, 9:03pm UTC](https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618/6 "2017-12-13T21:03:01Z")

</div>

Formatting is better but not correctly indented here. Not a big deal though.

Basically in Kibana Console it's well formatted. Just copy and paste the content in discuss but wrap with ``` lines...

Coming back to your problem, as I said, you need to use now `bool` instead of `filtered`. See [https://www.elastic.co/guide/en/elasticsearch/reference/5.6/breaking\_50\_search\_changes.html#\_deprecated\_queries\_removed](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/breaking_50_search_changes.html#_deprecated_queries_removed)

---

<div class="post-metadata">

**Author:** ![piyush](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@piyush](https://discuss.elastic.co/u/piyush)\
**Post date:** [December 14, 2017, 9:18pm UTC](https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618/7 "2017-12-14T21:18:34Z")

</div>

Thanks...

---

<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:** [January 11, 2018, 9:18pm UTC](https://discuss.elastic.co/t/query-es-2-3-to-es-5-5/111618/8 "2018-01-11T21:18:54Z")

</div>

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