Created
May 24, 2015 16:03
-
-
Save johntbush/89b66a79beadebc9d713 to your computer and use it in GitHub Desktop.
reindex field
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
updates="1" | |
while [ $updates -gt 0 ] | |
do | |
updates=`curl -s http://localhost:9200/fps-fbs_c94c36b8-e425-4bb8-b291-4b34f96d74ca*/_search -d '{ | |
"size" : 500, | |
"_source" : ["FbKey"], | |
"query" : { | |
"filtered" :{ | |
"query" : { | |
"multi_match" : { | |
"fields" : ["FbKey"], | |
"query" : "0", | |
"type" : "phrase_prefix" | |
} | |
}, | |
"filter" : { | |
"missing" : { | |
"field" : "FbKey.no_pad" | |
} | |
} | |
} | |
} | |
}' | \ | |
jq -c '.hits.hits[] | { "update" : {"_index" : ._index, "_id" :._id, "_type" : ._type}}, { "doc" : {"FbKey": ._source.FbKey}}' | \ | |
curl -s -XPOST --data-binary @- http://localhost:9200/_bulk | \ | |
jq '.items | length'` | |
echo "updated $updates records" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment