ElasticSearch: How to specify specific fields to search at? -
right in mapping, setting "include_in_all" true, means fields included in _all field.
however, when searching, instead of wasting space, , putting in _all field, want specify specific fields (and taking account boost scores in mapping).
how create query tells elastic search @ specific fields(not 1) , take account boosting gave during mapping?
start multi_match query. allows query multiple fields, giving them different weights, , it's way go when have search box.
{ "multi_match" : { "query" : "this test", "fields" : [ "subject^2", "message" ] } }
the query_string more powerful more dangerous since it's parsed , can break. use if need it.
Comments
Post a Comment