Index search for array of objects

Let’s say I have the following sample JSON coming form an external source:
        “person_id”: 123,
        “person_name”: ‘John’
        “person_id”: 456,
        “person_name”: ‘Mary’
    “department”: ‘Finance’,
    “contact_number”: '888-987-6543"

From my reading of indexes, it doesn’t look like I can build an array search on an array of objects. Do I need to restructure this somehow in order to search for person_id or person_name?

No, I assume there is something else wrong.

  name: "test",
  source: Collection("<your collection>"),
  terms: [
      field: ["data", "people", "person_id"]

Works fine here, it unrolls the array essentially. Maybe you are looking for something else? What do you mean with an array search exactly?

That makes perfect sense. I just had the syntax wrong. Thank you.

1 Like