I am new to dot net core. I am using https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/nest.html as my elastic search client.
I have following query for written in elastic search:
{
"query": {
"bool":{
"must":[
{
"term":{
"bookId.keyword":"c962ec04-6d25-4823-8e78-6d99d4072032"
}
},
{
"bool":{
"should":[
{
"match_phrase":{
"text":"Plants"
}
}
]
}
}
]
}
}
}
While my NEST code is:
var searchResponse = await _esClient.SearchAsync<Content>(s => s
.Query(q => q
.Bool(b => b
.Must(m => m
.Term(terms => terms.Field(
field => field.BookId.Suffix("keyword")
).Value(bookId.ToString())
)
)
.Must(should =>
should.Match(mp => mp.Field(f => f.Text).Query(query))
)
)
));
However I am unable to get the intended result. Can anyone help me with this?