Boolean searching a multi-value multi-field


#1

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!


How to require two analyzers to match terms AND positions in full-text searching?
(David Pilato) #2

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.


How to require two analyzers to match terms AND positions in full-text searching?
#3

OK, thank you for the quick reply!


(system) #4

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