0

Using the elastsearch-rails gem, currently I have:

response = Employee.search(
      size: 20, 
      query: {
            multi_match: { 
                  "query" => search_terms,
                  "type" => "cross_fields",
                  "fields" => ["first_name^3", "last_name^3", "full_name^4", "email", "job_description^5", "job_title^5"]
            }
        }
    )

What I notice is that by doing the multi-match / cross_fields search, if I search for a term that appears only once in an Employee database column (e.g., "John" would only appear in first_name, not job_description or job_title), then I get no results back. If a term, (say a job title like "lawyer" appears in more than 1 field such as job_description and job_title), I get results back. Why is this? This seems counter-intuitive.

Andrei Stefan
  • 51,654
  • 6
  • 98
  • 89
Nona
  • 5,302
  • 7
  • 41
  • 79

0 Answers0