Add refresh parameter to UpdateByQuery so that it will refresh the shards also for the relevant document and they will be available for search for the subsequent queries https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html#_refreshing_shards_2