Query es 2.3 to es 5.5

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.
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....

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.

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
}

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. 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.

sure, thanks...

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

{
  "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
}

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

Thanks...

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