vendredi 16 juillet 2021

Emailid searching in elastics search

This search fails for emailid as it contains @. How can I solve this? Or can i use wildcard with multimatch?

result = TestIndex::Test
                         .filter(match: { account_id: hotel.account_id })
                         .query(query_string: {
                          query: "*"+query_text+"*",
                          fields: ['first_name', 'last_name', 'phones', 'emails', 'room']
                          })
                         .highlight({ pre_tags: ['<mark>'], post_tags: ['</mark>'],
                                      number_of_fragments: 0,
                                      fields: {
                                          'first_name': { number_of_fragments: 0 },
                                          'last_name': { number_of_fragments: 0 },
                                          'phones': { number_of_fragments: 0 },
                                          'emails': { number_of_fragments: 0 }
                                      }
                         })
                         .paginate(page: page, per_page: page_size).as_json
    

Aucun commentaire:

Enregistrer un commentaire