Hithighlighting boolean query including exact phrase words

(Hardik) #1


We are using ElasticSearch with version 2.4.

When we do search in a field for query as below in a field, it is not highlighting the complete phrase word.

(Google OR Bing) AND "SQL Developer"

The above query gives result properly, but if we use it with Hit-highlighting, it highlights not only Google and Bing, but it also consider the both SQL and Developer as separate words and highlight them separately instead of highlighting only exact phrase "SQL Developer" .

Below is the C# code, we are using for the same.

string keyword = @"(Google OR Bing) AND "SQL Developer"";
var filterQueries = new List<Func<QueryContainerDescriptor, QueryContainer>>();
filterQueries.Add(m2 =>
m2.QueryString(m3 => m3.Fields("Note").Query(Keyword)));

ISearchResponse result = client.Search(S => S.From(0)
.Query(q => q
.Bool(b => b
.Highlight(h => h
fs => fs
.Field(p => p.Note)

Please help me if we are missing out any thing in query code.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.