Skip to content

Instantly share code, notes, and snippets.

@faishal
Created April 16, 2018 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faishal/41e4ba29dab6b4f1f26076e09e5fc254 to your computer and use it in GitHub Desktop.
Save faishal/41e4ba29dab6b4f1f26076e09e5fc254 to your computer and use it in GitHub Desktop.
ElasticPress index all sites in network
#!/bin/bash
for SITE_URL in $(wp site list --fields=domain,path,archived,deleted --format=csv --url=cmsdev.sc.com | grep ",0,0$" | awk -F ',' '{print $1 $2}')
do
echo "Indexing $SITE_URL ..."
echo "--- BEGIN INDEXING $SITE_URL ---" &>> indexing.log
wp elasticpress index --setup --url="$SITE_URL" --show-bulk-errors &>> indexing.log
echo "--- END INDEXING $SITE_URL ---" &>> indexing.log
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment