Last active
April 7, 2016 14:05
-
-
Save up1/d03e1ba2aad382cdd1f521a9a12f716c to your computer and use it in GitHub Desktop.
Elasticsearch RE-indexing
This file contains hidden or 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/sample_new' -d '{ | |
| "mappings" : { | |
| "videos" : { | |
| "properties" : { | |
| "tags" : { "type" : "string", "index" : "not_analyzed" } | |
| } | |
| } | |
| } | |
| }' |
This file contains hidden or 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/_reindex' -d '{ | |
| "size" : 3, | |
| "source" : { | |
| "index" : "sample", | |
| "type" : "videos", | |
| "query" : { | |
| "term" : { | |
| "tags" : "elasticsearch" | |
| } | |
| }, | |
| "sort" : { | |
| "upload_date" : "desc" | |
| } | |
| }, | |
| "dest" : { | |
| "index" : "sample_new" | |
| } | |
| }' |
This file contains hidden or 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/_reindex' -d '{ | |
| "source" : { | |
| "index" : "sample" | |
| }, | |
| "dest" : { | |
| "index" : "sample_new", | |
| "version_type": "external" | |
| } | |
| }' |
This file contains hidden or 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/sample_new' -d '{ | |
| "mappings" : { | |
| "videos" : { | |
| "properties" : { | |
| "tags" : { "type" : "string", "index" : "not_analyzed" } | |
| } | |
| } | |
| } | |
| }' | |
| cd ./sample-documents | |
| for file in *.json; do | |
| echo -n $file | |
| curl -XPOST localhost:9200/sample_new/videos/ -d "`cat $file`" | |
| echo | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment