Skip to content

Instantly share code, notes, and snippets.

@bartfastiel
Created February 15, 2017 09:40
Show Gist options
  • Save bartfastiel/2a010d010ea8f81e429aac000751a871 to your computer and use it in GitHub Desktop.
Save bartfastiel/2a010d010ea8f81e429aac000751a871 to your computer and use it in GitHub Desktop.
echo delete index
curl -XDELETE 'http://127.0.0.1:9200/shardtermfrequency?pretty=1'
echo create index
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency?pretty=1'
echo create type
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency/_mapping/file?pretty=1'
echo insert files
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency/file/1?routing=0&pretty=1' -d'{
"fileName":"Elastic Match"
}'
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency/file/2?routing=1&pretty=1' -d'{
"fileName":"My Elastic Match"
}'
echo flush
curl -XPOST 'http://127.0.0.1:9200/shardtermfrequency/_flush?pretty=1'
echo search
curl -XGET 'http://127.0.0.1:9200/shardtermfrequency/file/_search?pretty=1' -d '{
"size":2,
"query":{
"match":{
"fileName":"Elastic Match"
}
}
}'
echo search with constant score
curl -XGET 'http://127.0.0.1:9200/shardtermfrequency/file/_search?pretty=1' -d '{
"size":2,
"query":{
"constant_score": {
"query":{
"match":{
"fileName":"Elastic Match"
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment