Nested filter issue when using sort

1k Views Asked by At

After upgrading from Elasticsearch 5.0 to Elasticsearch 6.4 I get the following warnings when using sort:

! Deprecation: [nested_path] has been deprecated in favor of the [nested] parameter

! Deprecation: [nested_filter] has been deprecated in favour for the [nested] parameter

When using ongr/elasticsearch-dsl my sort query looks like this:

"sort": [
    {
      "_channels._showOrder": {
        "nested_path": "_channels",
        "order": "asc",
        "nested_filter": {
          "term": {
            "_channels.id": 1658
          }
        }
      }
    }
  ],

In Elasticsearch 6.4 it should look like this:

"sort" : [
       {
          "_channels._showOrder" : {
             "order" : "asc",
             "nested": {
                "path": "_channels",
                "filter": {
                   "term" : { "_channels.id" : 1658 }
                }
             }
          }
       }
    ]

It seems that FieldSort needs to be updated to support the new structure. Currently setNestedFilter for FieldSort is using deprecated syntax.

It still works, but I don't like getting the deprecation warnings and at some point it will probably raise an error.

0

There are 0 best solutions below