Nested query no longer working in ES 6.0


(Lars) #1

Hey guys,

we upgraded our system running ES5.4 to ES6.0. We used some nested querys for months that are no longer working after the upgrade...they fail with

"...[nested] nested object under path [dates] is not of nested type"

But the mentioned field has the nested type...

Here is a simplified mapping and query...the real one is way bigger but this one is also not working...

PUT products
{
    "settings" : {
        "index" : {
            "number_of_shards" : 3, 
            "number_of_replicas" : 2 
        }
    },
    "mappings": {
      "basics": {
        "properties": {
          "sku": {
            "type": "text",
            "index": "false"
          },
          "title": {
            "type": "text",
            "index": "true"
          },
          "image": {
            "type": "text",
            "index": "false"
          },
          "productmanager": {
            "type": "text",
            "index": "true"
          },
          "dates": {
            "type": "nested",
            "properties": {
              "date-origin": {
                "type": "date",
                "format": "dd.mm.YYYY"
              },
              "date-destination": {
                "type": "date",
                "format": "dd.mm.YYYY"
              },
              "instock": {
                "type": "byte"
              }              
            }
          }
        }
      }
    }
}

And the query...

GET _search
{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "(sku:*)"
          }
        },
        {
          "nested": {
            "path": "dates",
            "query": {
              "bool": {
                "must": [
                  {
                    "term": {
                      "dates.instock": 0
                    }
                  }
                ]
              }
            },
            "inner_hits": {}
          }
        }
      ]
    }
  }
}

So i have no idea whats wrong with it...
Are there any changes to nested types in ES6..i couldnt find anything in the docs...

Thx!!!


(David Pilato) #2

Could you provide a full recreation script as described in

It will help to better understand what you are doing.
Please, try to keep the example as simple as possible.


(Lars) #3

Sorry , i edited my post to meet the standards...


(David Pilato) #4

Great. Could you provide as well some sample documents?
So we can replay your test?


(Lars) #5

Of course...here is a simple document...let's say i want to receive all product-dates with instock=1...
I'm always getting the error as above...

PUT products/basics/1
{
    "sku" : "12345",
    "title" : "test product",
    "image" : "test_high.jpg",
    "productmanager": "none",
    "dates":[
      {
        "date-origin": "01.01.2018",
        "date-destination": "10.01.2018",
        "instock": 1
      },
      {
        "date-origin": "20.01.2018",
        "date-destination": "30.01.2018",
        "instock": 0
      }
    ]
}

(system) closed #6

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