Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter skyscraper1709

    (@skyscraper1709)

    Resorted to a solution using a bash script:

    Object-id corresponds to WP post ID.
    The sync is set in backend to 10 times for every run and we are Looping 2000 items every iteration.
    So –per-page needs to be set at 200.

    Finally 2000 items every iteration of our loop.

    The code:

    
    #!/bin/bash
    #Get the most recent post ID
    last_id=$(wp post list --field=ID --posts_per_page=1 | xargs)
    #loop back till the first post 2000 at a time.
    for (( c=last_id; c>2000; c=c-2000 )); do
     d=$((c-2000));
     echo "Start: $c";
     echo "End: $d";
     # run elastic press sync by parts
     wp elasticpress sync --per-page=200 --lower-limit-object-id="$d" --upper-limit-object-id="$c"
    done
    • This reply was modified 1 year, 3 months ago by skyscraper1709. Reason: code indentation
Viewing 1 replies (of 1 total)