I'm trying to run a search with Wagtail (5.2) and Elastic (7)
When I make a search for Users wagtail_admin/users/?q=ffff I got such error
FilterFieldError
Cannot filter search results with field "email". Please add index.FilterField('email') to User.search_fields
Then I add extra field to search fields in the code
class User:
search_fields = [
index.SearchField("name", partial_match=True),
index.FilterField("email", partial_match=True),
]
But just got another error
FilterError /wagtail_admin/users/
Could not apply filter on search results: "email__icontains = ffff". Lookup "icontains"" not recognised.
How it can be fixed?
According to documentation of wagtail, you need to use
SearchFieldfor full-text search, try replacing theindex.FilterFieldwithindex.SearchField: