Include date range in _all search


(Michael La Colla) #1

My current query below works great. You can assume 'first', 'last', and 'dateOfBirth' is included in _all.

{
  "query": {
        "match": {
           "_all": {
               "query": "foo bar",
               "operator": "and",
               "fuzziness": 1,
               "prefix_length": 1
           }
        }
    }
}

Now, I wanted to add a layer of intuitive search on dates that allow different format of date search capability. For example, input of January 1, 1998 and 01/01/1998. My proof of concept below works for search DIRECTLY on the DateOfBirth field.

{
  "query": {
    "range": {
      "dateofBirth": {
        "lte": "March 16, 2016",
        "gte": "03/16/2016",
        "format": "MM/dd/yyyy||MMMM dd, yyyy"
      }
    }
  }
}

Now comes the big question, how do i take this proof of concept and make it one query where I can search across _all field (first, last, dateOfBirth) with the intuitive search??? It will be one query with one input box from a user. I appreciate any help! :slight_smile:

Example 1: John Doe March 16, 2016

Example 2: John Doe 03/16/2016


(system) #2