Created
January 31, 2014 22:46
-
-
Save alexbrasetvik/8744808 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_type: district | |
title: there | |
--- | |
_type: street | |
title: there | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Auto generated by Found's Play-tool at 2014-01-31T23:47:04+01:00 | |
version: 0 | |
title: boosting a certain type | |
description: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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