Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Document boosting with Elasticsearch
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"
}
}
}
}
}
'
curl -XPOST localhost:9200/boosts -d '
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"doc": {
"properties": {
"text": {
"type": "string"
},
"boost": {
"type": "double"
}
}
}
}
}'
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?"
}'
curl -XPUT localhost:9200/boosts/doc/_mapping -d '
{
"doc": {
"properties": {
"text_no_norms": {
"type": "string",
"norms": { "enabled": false }
}
}
}
}
'
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