Created
July 30, 2012 14:45
-
-
Save uliSchi/3207478 to your computer and use it in GitHub Desktop.
elasticsearch boost problem
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 -XDELETE 'http://localhost:9200/myindex' | |
curl -XPOST 'http://localhost:9200/myindex' | |
curl -XPOST 'http://localhost:9200/_refresh' | |
curl -XPUT 'http://localhost:9200/myindex/author/_mapping' -d '{ | |
"author": { | |
"_boost": { | |
"name": "boostFactor", | |
"null_value": 1.0 | |
}, | |
"properties": { | |
"id": { | |
"type": "long" | |
}, | |
"boostFactor": { | |
"type": "float", | |
"null_value": 1.0 | |
}, | |
"name": { | |
"type": "string", | |
"index": "not_analyzed", | |
"boost": 20.0 | |
}, | |
"countryOfBirth": { | |
"type": "string" | |
} | |
} | |
} | |
}' | |
curl -XPUT 'http://localhost:9200/myindex/author/1' -d '{ | |
"id": 1, | |
"boostFactor": 0.22, | |
"name": "Sewald Kruse", | |
"countryOfBirth": "Deutschland" | |
}' | |
curl -XPUT 'http://localhost:9200/myindex/author/2' -d '{ | |
"id": 2, | |
"boostFactor": 0.61, | |
"name": "Sergio Herold", | |
"countryOfBirth": "Peru" | |
}' | |
curl -XPUT 'http://localhost:9200/myindex/author/3' -d '{ | |
"id": 3, | |
"boostFactor": 0.03, | |
"name": "Sebastion Wund", | |
"countryOfBirth": "Deutschland" | |
}' | |
curl -XPUT 'http://localhost:9200/myindex/author/4' -d '{ | |
"id": 4, | |
"boostFactor": 0.07, | |
"name": "Gudrun Weil", | |
"countryOfBirth": "Serbien" | |
}' | |
curl -XPOST 'http://localhost:9200/_refresh' | |
curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{ | |
"query": { | |
"prefix": { | |
"name": "Se" | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment