Boolean searching a multi-value multi-field

Hello all, I have some documents that look something like this:

{
"dataset_id": 1,
"table_name": "some names",
"columns": ["col1", "col2", "surname"],
"records": [
  {
    "values": ["val1", "", "JOHNSON"],
    "names": ["JOHNSON"]
  },
  {
    "values": ["val1", "", "DELMAN JANSON"],
    "names": ["DELMAN", "JANSON"]
  }        
]
}

The names field has been analyzed by multiple analyzers (phonetic, edge n-gram, etc.).

How can I construct a query to require, e.g., that names[x].phonetic matches AND names[x].ngram matches? Right now I can figure out how to match names.phonetic AND names.ngram, but I can't figure out how to ensure that the AND applies to the same element within the list. Hoping I don't have to create a separate nested document for every item in names.

Thank you for your help!

Yes you need to use a nested data type for this.
Or you can denormalize your data and index only the element of the array as a single document.

OK, thank you for the quick reply!

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