Elasticsearch-PHP reindex not working as expected



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Documentation on reindex API: https://www.elastic.co/guide/en/elasticsearch/client/php-api/6.0/ElasticsearchPHP_Endpoints.html#Elasticsearch_Clientreindex_reindex



/*
$params['refresh'] = (boolean) Should the effected indexes be refreshed?
['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable
['consistency'] = (enum) Explicit write consistency setting for the operation
['wait_for_completion'] = (boolean) Should the request should block until the reindex is complete
['requests_per_second'] = (float) The throttle for this request in sub-requests per second. 0 means set no throttle
['body'] = (array) The search definition using the Query DSL and the prototype for the index request (Required)
['body'] = (array) Request body
*/

$params = [
// ...
];

$client = ClientBuilder::create()->build();
$response = $client->reindex($params);


Elasticsearch version is 5.6.13.



I was attempting to reindex a source index to a destination index using the PHP client's reindex API above. The sourceIndex has only 1 document.



Request:



$params = [
'body' => [
'source' => [
'index' => 'sourceIndex',
],
'dest' => [
'index' => 'destIndex'
]
]
];
$response = $client->reindex($params);


Response:



(
[took] => 2
[timed_out] =>
[total] => 0
[updated] => 0
[created] => 0
[deleted] => 0
[batches] => 0
[version_conflicts] => 0
[noops] => 0
[retries] => Array
(
[bulk] => 0
[search] => 0
)

[throttled_millis] => 0
[requests_per_second] => -1
[throttled_until_millis] => 0
[failures] => Array
(
)

)


As you can see, the document reindexed is 0 ([total] => 0).



It works just fine when done using Kibana's DevTool, but not elasticsearch-php client.



POST _reindex

"source":
"index": "sourceIndex"
,
"dest":
"index": "destIndex"




Any help is appreciated. If you need more details to help answer this question, let me know.










share|improve this question




























    0















    Documentation on reindex API: https://www.elastic.co/guide/en/elasticsearch/client/php-api/6.0/ElasticsearchPHP_Endpoints.html#Elasticsearch_Clientreindex_reindex



    /*
    $params['refresh'] = (boolean) Should the effected indexes be refreshed?
    ['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable
    ['consistency'] = (enum) Explicit write consistency setting for the operation
    ['wait_for_completion'] = (boolean) Should the request should block until the reindex is complete
    ['requests_per_second'] = (float) The throttle for this request in sub-requests per second. 0 means set no throttle
    ['body'] = (array) The search definition using the Query DSL and the prototype for the index request (Required)
    ['body'] = (array) Request body
    */

    $params = [
    // ...
    ];

    $client = ClientBuilder::create()->build();
    $response = $client->reindex($params);


    Elasticsearch version is 5.6.13.



    I was attempting to reindex a source index to a destination index using the PHP client's reindex API above. The sourceIndex has only 1 document.



    Request:



    $params = [
    'body' => [
    'source' => [
    'index' => 'sourceIndex',
    ],
    'dest' => [
    'index' => 'destIndex'
    ]
    ]
    ];
    $response = $client->reindex($params);


    Response:



    (
    [took] => 2
    [timed_out] =>
    [total] => 0
    [updated] => 0
    [created] => 0
    [deleted] => 0
    [batches] => 0
    [version_conflicts] => 0
    [noops] => 0
    [retries] => Array
    (
    [bulk] => 0
    [search] => 0
    )

    [throttled_millis] => 0
    [requests_per_second] => -1
    [throttled_until_millis] => 0
    [failures] => Array
    (
    )

    )


    As you can see, the document reindexed is 0 ([total] => 0).



    It works just fine when done using Kibana's DevTool, but not elasticsearch-php client.



    POST _reindex

    "source":
    "index": "sourceIndex"
    ,
    "dest":
    "index": "destIndex"




    Any help is appreciated. If you need more details to help answer this question, let me know.










    share|improve this question
























      0












      0








      0








      Documentation on reindex API: https://www.elastic.co/guide/en/elasticsearch/client/php-api/6.0/ElasticsearchPHP_Endpoints.html#Elasticsearch_Clientreindex_reindex



      /*
      $params['refresh'] = (boolean) Should the effected indexes be refreshed?
      ['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable
      ['consistency'] = (enum) Explicit write consistency setting for the operation
      ['wait_for_completion'] = (boolean) Should the request should block until the reindex is complete
      ['requests_per_second'] = (float) The throttle for this request in sub-requests per second. 0 means set no throttle
      ['body'] = (array) The search definition using the Query DSL and the prototype for the index request (Required)
      ['body'] = (array) Request body
      */

      $params = [
      // ...
      ];

      $client = ClientBuilder::create()->build();
      $response = $client->reindex($params);


      Elasticsearch version is 5.6.13.



      I was attempting to reindex a source index to a destination index using the PHP client's reindex API above. The sourceIndex has only 1 document.



      Request:



      $params = [
      'body' => [
      'source' => [
      'index' => 'sourceIndex',
      ],
      'dest' => [
      'index' => 'destIndex'
      ]
      ]
      ];
      $response = $client->reindex($params);


      Response:



      (
      [took] => 2
      [timed_out] =>
      [total] => 0
      [updated] => 0
      [created] => 0
      [deleted] => 0
      [batches] => 0
      [version_conflicts] => 0
      [noops] => 0
      [retries] => Array
      (
      [bulk] => 0
      [search] => 0
      )

      [throttled_millis] => 0
      [requests_per_second] => -1
      [throttled_until_millis] => 0
      [failures] => Array
      (
      )

      )


      As you can see, the document reindexed is 0 ([total] => 0).



      It works just fine when done using Kibana's DevTool, but not elasticsearch-php client.



      POST _reindex

      "source":
      "index": "sourceIndex"
      ,
      "dest":
      "index": "destIndex"




      Any help is appreciated. If you need more details to help answer this question, let me know.










      share|improve this question














      Documentation on reindex API: https://www.elastic.co/guide/en/elasticsearch/client/php-api/6.0/ElasticsearchPHP_Endpoints.html#Elasticsearch_Clientreindex_reindex



      /*
      $params['refresh'] = (boolean) Should the effected indexes be refreshed?
      ['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable
      ['consistency'] = (enum) Explicit write consistency setting for the operation
      ['wait_for_completion'] = (boolean) Should the request should block until the reindex is complete
      ['requests_per_second'] = (float) The throttle for this request in sub-requests per second. 0 means set no throttle
      ['body'] = (array) The search definition using the Query DSL and the prototype for the index request (Required)
      ['body'] = (array) Request body
      */

      $params = [
      // ...
      ];

      $client = ClientBuilder::create()->build();
      $response = $client->reindex($params);


      Elasticsearch version is 5.6.13.



      I was attempting to reindex a source index to a destination index using the PHP client's reindex API above. The sourceIndex has only 1 document.



      Request:



      $params = [
      'body' => [
      'source' => [
      'index' => 'sourceIndex',
      ],
      'dest' => [
      'index' => 'destIndex'
      ]
      ]
      ];
      $response = $client->reindex($params);


      Response:



      (
      [took] => 2
      [timed_out] =>
      [total] => 0
      [updated] => 0
      [created] => 0
      [deleted] => 0
      [batches] => 0
      [version_conflicts] => 0
      [noops] => 0
      [retries] => Array
      (
      [bulk] => 0
      [search] => 0
      )

      [throttled_millis] => 0
      [requests_per_second] => -1
      [throttled_until_millis] => 0
      [failures] => Array
      (
      )

      )


      As you can see, the document reindexed is 0 ([total] => 0).



      It works just fine when done using Kibana's DevTool, but not elasticsearch-php client.



      POST _reindex

      "source":
      "index": "sourceIndex"
      ,
      "dest":
      "index": "destIndex"




      Any help is appreciated. If you need more details to help answer this question, let me know.







      php elasticsearch elasticsearch-5 reindex






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 '18 at 14:35









      Dorjee DhondupDorjee Dhondup

      162210




      162210






















          1 Answer
          1






          active

          oldest

          votes


















          0














          FYI - In case someone happens to face the same issue. The issue was that the source index had refresh_interval set to -1. For reindex operation to work, just refresh the source index prior to calling the _reindex API.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321777%2felasticsearch-php-reindex-not-working-as-expected%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            FYI - In case someone happens to face the same issue. The issue was that the source index had refresh_interval set to -1. For reindex operation to work, just refresh the source index prior to calling the _reindex API.






            share|improve this answer



























              0














              FYI - In case someone happens to face the same issue. The issue was that the source index had refresh_interval set to -1. For reindex operation to work, just refresh the source index prior to calling the _reindex API.






              share|improve this answer

























                0












                0








                0







                FYI - In case someone happens to face the same issue. The issue was that the source index had refresh_interval set to -1. For reindex operation to work, just refresh the source index prior to calling the _reindex API.






                share|improve this answer













                FYI - In case someone happens to face the same issue. The issue was that the source index had refresh_interval set to -1. For reindex operation to work, just refresh the source index prior to calling the _reindex API.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 16 '18 at 20:31









                Dorjee DhondupDorjee Dhondup

                162210




                162210





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321777%2felasticsearch-php-reindex-not-working-as-expected%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kleinkühnau

                    Makov (Slowakei)

                    Deutsches Schauspielhaus