I'm new to ElasticSearch. Now I have a requirement that need to return all result which contains the keyword.
public Class People(){
public string UserId {get; set;}
public string FirstName {get; set;}
public string LastName {get; set;}
}
I want to filter all People if one of three fileds contains the keyword, similar to like "%keyword%".
For example,I have a People
var people = new People() {
UserId = "lastname.middlename.firstname",
FirstName = "firstname",
LastName = "lastname"
}
How I could get this Peoplle by searching the keyword ddl, How to setup the index and how to query.
I have tried to query with NEST like below
var keyword = "ddl"
var result = await _client.SearchAsync<People>(s =>
s.Query(q => q.MultiMatch(m => m.Fields(f => f.Field(ff => ff.UserId).Field(ff => ff.FirstName).Field(ff => ff.LastName)).Query(keyword)))
);
It won't work. It only work when I changed the keyword to firstname or lastname or lastname.middlename.firstname
Is there any way to meet the requirement?