从一个索引中提取出部分数据到新的索引中

    1. # reindex data by filter
    2. # POST _reindex?wait_for_completion=false
    3. {
    4. "source": {
    5. "index": "source_idx",
    6. "size" : 10000,
    7. "query": {
    8. "bool": {
    9. "filter": [
    10. {
    11. "range": {
    12. "event_time": {
    13. "gte": "2019-04-04||/M",
    14. "lt": "2019-04-04"
    15. }
    16. }
    17. }
    18. ]
    19. }
    20. }
    21. },
    22. "dest": {
    23. "index": "dest_idx"
    24. }
    25. }

    :::tips size表示ES一次重索引的文档数量(用的bulk接口) :::

    reindex时使用pipeline

    1. # POST _reindex?wait_for_completion=false
    2. {
    3. "source": {
    4. "index": "source_idx",
    5. "size" : 10000
    6. },
    7. "dest": {
    8. "index": "dest_idx",
    9. "pipeline": "monthlyindex"
    10. }
    11. }

    建议看看reindex的官方文档