I creat this function:
public static ISearchResponse<Immo> searchImmoByCustomerField(Nest.ElasticClient esClient, string esIndex, string esIndex2, int from, int take, string qField, string nmqField, string qTerm, string nmqTerm)
{
var result = esClient.Search<Immo>(s => s
.AllIndices()
.Query(q => q
.Indices(i => i
.Indices(new[] { esIndex, esIndex2 })
.Query(iq => iq.Term(qField, qTerm))
.NoMatchQuery(iq => iq.Term(nmqField, nmqTerm))
)
)
);
return result;
}
The function looking in 2 Indices for a search term. Visual Studio show me the message:
"Deprecated. You can specify _index on the query to target specific indices"
But how can i do that?
NoMatchQuery? Because the deprecation comes from Elasticsearch 5 itself, deprecating the index query