elasticsearch - Boost rank for special type of document -


i have index 2 types of document: district , street. boost rank of district documents.

is there way without script option?

you can use custom_filters_score boost documents matching filter, , filter can type-filter.

here's runnable example can play with: https://www.found.no/play/gist/8744808

#!/bin/bash  export elasticsearch_endpoint="http://localhost:9200"  # index documents curl -xpost "$elasticsearch_endpoint/_bulk?refresh=true" -d ' {"index":{"_index":"play","_type":"district"}} {"title":"there"} {"index":{"_index":"play","_type":"street"}} {"title":"there"} '  # searches  curl -xpost "$elasticsearch_endpoint/_search?pretty" -d ' {     "query": {         "custom_filters_score": {             "query": {                 "match": {                     "title": {                         "query": "there"                     }                 }             },             "filters": [                 {                     "boost": 2,                     "filter": {                         "type": {                             "value": "district"                         }                     }                 }             ]         }     } } ' 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -