Last active
February 15, 2017 09:40
-
-
Save bartfastiel/cbdccfa0d0abfba3b678d81010fc00ab to your computer and use it in GitHub Desktop.
elasticsearch: idf in shards
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
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' -d '{ | |
"settings" : { | |
"index" : { | |
"number_of_shards" : 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 Shard0" | |
}' | |
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency/file/2?routing=1&pretty=1' -d'{ | |
"fileName":"Elastic Match Shard1" | |
}' | |
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency/file/3?routing=1&pretty=1' -d'{ | |
"fileName":"Elastic" | |
}' | |
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" | |
} | |
} | |
}' |
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
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' -d '{ | |
"settings" : { | |
"index" : { | |
"number_of_shards" : 2 | |
} | |
} | |
}' | |
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 Shard0" | |
}' | |
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency/file/2?routing=1&pretty=1' -d'{ | |
"fileName":"Elastic Match Shard1" | |
}' | |
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency/file/3?routing=1&pretty=1' -d'{ | |
"fileName":"Elastic" | |
}' | |
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" | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment