Created
February 16, 2014 00:38
-
-
Save brusic/9027491 to your computer and use it in GitHub Desktop.
Document boosting with Elasticsearch
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
curl -XPOST localhost:9200/boosts -d ' | |
{ | |
"settings": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0 | |
}, | |
"mappings": { | |
"doc": { | |
"_boost": { | |
"name": "boost", | |
"null_value": 1.0 | |
}, | |
"properties": { | |
"text": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
} | |
' |
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
curl -XPOST localhost:9200/boosts -d ' | |
{ | |
"settings": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0 | |
}, | |
"mappings": { | |
"doc": { | |
"properties": { | |
"text": { | |
"type": "string" | |
}, | |
"boost": { | |
"type": "double" | |
} | |
} | |
} | |
} | |
}' |
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
curl -XPUT 'http://localhost:9200/boosts/doc/1' -d '{ | |
"text" : "The quick brown fox jumped over the lazy dog", | |
"text_no_norms" : "The quick brown fox jumped over the lazy dog", | |
"boost" : 100 | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/2' -d '{ | |
"text" : "The quick black fox leaped over the sleeping dog" , | |
"text_no_norms" : "The quick black fox leaped over the sleeping dog" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/3' -d '{ | |
"text" : "Mr. Fox", | |
"text_no_norms" : "Mr. Fox", | |
"boost" : 50 | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/4' -d '{ | |
"text" : "Dr. Dog", | |
"text_no_norms" : "Dr. Dog", | |
"boost" : 100 | |
}' | |
################# | |
curl -XPUT 'http://localhost:9200/boosts/doc/5' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?", | |
"text_no_norms" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/6' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?", | |
"text_no_norms" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/7' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?", | |
"text_no_norms" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/8' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?", | |
"text_no_norms" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/9' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?", | |
"text_no_norms" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/10' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?", | |
"text_no_norms" : "Trying out Elasticsearch, so far so good?" | |
}' |
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
curl -XPUT localhost:9200/boosts/doc/_mapping -d ' | |
{ | |
"doc": { | |
"properties": { | |
"text_no_norms": { | |
"type": "string", | |
"norms": { "enabled": false } | |
} | |
} | |
} | |
} | |
' |
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
curl -XPUT 'http://localhost:9200/boosts/doc/1' -d '{ | |
"text" : "The quick brown fox jumped over the lazy dog", | |
"boost" : 100 | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/2' -d '{ | |
"text" : "The quick black fox leaped over the sleeping dog" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/3' -d '{ | |
"text" : "Mr. Fox", | |
"boost" : 50 | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/4' -d '{ | |
"text" : "Dr. Dog", | |
"boost" : 100 | |
}' | |
################# | |
curl -XPUT 'http://localhost:9200/boosts/doc/5' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/6' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/7' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/8' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/9' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?" | |
}' | |
curl -XPUT 'http://localhost:9200/boosts/doc/10' -d '{ | |
"text" : "Trying out Elasticsearch, so far so good?" | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment