elasticsearch - Extracting matching conditions from querystring -


elasticsearch query formed using query string multiple , / or operators. i.e. ((condition 1 or condition 2) , (condition 3 or condition 4 or condition 5)), based on condition provides me multiple documents. getting exact condition again loop through resultant documents again , mark particular conditions. there simple way resultant conditions specific documents ?

can provide better example using nest api?

i think need highlight data made hit on query. highlight functionality of elasticsearch marks text each search result user can see why document matched query. marked text returned in response.

please refer in elasticsearch documentation in order understand how api works. refer in nest documentation in order see how can implement nest library.

for example, using elasticsearch api imagine below example:

get /someindex/sometype/_search {     "query" : {         "match_phrase" : {             "about" : "rock climbing"         }     },     "highlight": {         "fields" : {             "about" : {}         }     } } 

the same nest:

var result = _client.search<someindex>(s => s     .query(q => q         .matchphrase(qs => qs             .onfield(e => e.about)             .query("rock climbing")         )     )     .highlight(h => h         .onfields(f => f             .onfield(e => e.about)         )     ) ); 

the response of below form each search result (notice highlight part)

"_score": 0.23013961, "_source": {    "first_name":  "john",    "last_name":   "smith",    "age":         25,    "about":       "i love go rock climbing",    "interests": [ "sports", "music" ] }, "highlight": {    "about": [       "i love go <em>rock</em> <em>climbing</em>"     ] } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -