javascript - Does the match query return only results base on score? -


hello have following object:

{   type:'foo'   users: [{id: myid roles:['admin','fooadmin']},              {id: myid2 roles:['admin']}] } 

and using bool query objects users id. following term:

'term': {          'users.id': 'myid'         } 

it works except when id has capital letters in it. searched little , found out match query alternative:

{  "query":    {     "match":      {       "users.userid":token._source.userid      }    } } 

so far been working me because case sensitive. lately i've heard match query gets 'best results',meaning gets results best score. true? i'm risking not objects want match query?

match query takes query string, analyzes it, , turns analyzed tokens or query. reason case sensitive because there's lowercase filter in analyzer.

so query string like

"brown dog"

would turned 2 tokens , lowercased, like

[brown] or [dog]

which both retrieve , rank results based on relevance 2 terms. relevance formula complex, you'll results sorted on relevance.

the exception argument minimum_should_match, if set can control how many terms in or query above must match document in resulting set. however, defaults 1, won't impact here.

if want exact string matching lowercasing without tokenization business, can create custom analyzer strings keywordtokenizer (basically means no tokenizer) , lowercase filter.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -