Skip to content

Instantly share code, notes, and snippets.

@alexbrasetvik
Created January 31, 2014 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexbrasetvik/8744808 to your computer and use it in GitHub Desktop.
Save alexbrasetvik/8744808 to your computer and use it in GitHub Desktop.
_type: district
title: there
---
_type: street
title: there
#!/bin/bash
export ELASTICSEARCH_ENDPOINT="http://localhost:9200"
# Create indexes
curl -XPUT "$ELASTICSEARCH_ENDPOINT/play" -d '{
"settings": {}
}'
# Index documents
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_bulk?refresh=true" -d '
{"index":{"_index":"play","_type":"district"}}
{"title":"there"}
{"index":{"_index":"play","_type":"street"}}
{"title":"there"}
'
# Do searches
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_search?pretty" -d '
{
"query": {
"custom_filters_score": {
"query": {
"match": {
"title": {
"query": "there"
}
}
},
"filters": [
{
"boost": 2,
"filter": {
"type": {
"value": "district"
}
}
}
]
}
}
}
'
# Auto generated by Found's Play-tool at 2014-01-31T23:47:04+01:00
version: 0
title: boosting a certain type
description: ""
# In reply to http://stackoverflow.com/questions/21489407/boost-rank-for-special-type-of-document
query:
custom_filters_score:
query:
match:
title:
query: there
filters:
- boost: 2
filter:
type:
value: district
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment