Combine fields in query

Hi,

I have the following document in my index:

{
  "_id": "0012020310",
  "_source": {
    "ConstructionProject": {
      "Candidates": [
        {
          "InterestIndicator": "NORMAL",
          "State": "CONTRACTOR"
        },
		{
          "InterestIndicator": "BIG",
          "State": "CLIENT"
        }
      ]
  }
}

If i send the following query (ConstructionProject.Candidates.InterestIndicator:NORMAL AND ConstructionProject.Candidates.State:CLIENT) to my elastic I get the document above back. That's perfect but it's not what I need. I need a query which searches on "Candidate" level which means, the document should get returned if the query fields "InterestIndicator:NORMAL" AND "State:CLIENT" will be found in one single candidate. Has anyone an idea?

THANKS

Hi Josef,
You need to use the nested datatype and nested query for these scenarios when you need to match >1 field of an object in an array.

1 Like

Hello Mark, this is what I've been looking for, thank you very much!

1 Like

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