Nested Query Search not working

I have a mapping written in DSL as follows:

class job:
    properties = {
        'company_name': Text(index='not_analyzed', term_vector='yes'),
        'start_date': Text(index='not_analyzed', term_vector='yes'),
        'end_date': Text(index='not_analyzed', term_vector='yes'
}

Job_exp = Nested(
    doc_class=InnerObjectWrapper,
    properties=job.properties
)

So, job_exp is a nested field with property company_name, start_date and end_date. I am running a nested query search as follows:

GET /_search
    {
      "query": {
          "bool": {
             "must": [
                
                {
                   "nested": {
                      "path": "job_exp",
                      "query": {
                         "bool": {
                            "must": [
                               {
                                  "match": {
                                     "job_exp.company_name": "Apple"
                                  }
                               }
                            ]
                         }
                      }
                   }
                }
             ]
          }
       }
    }

However, I'm getting this error:

"type": "illegal_state_exception",
"reason": "[nested] nested object under path [job_exp]  is not of nested type"

Can someone please help with this error?

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