PHP Classes

PHP ElasticSearch Bulk Insert: Insert many record values at once in ElasticSearch

Recommend this page to a friend!
  Info   View files Documentation   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 122 All time: 9,473 This week: 524Up
Version License PHP version Categories
elastic-search-bulk 1.0.0Free For Educatio...7Searching, Web services, PHP 7


This class can insert many record values at once in ElasticSearch.

It can connect to one ElasticSearch server instance and takes an array of data values to insert in a given ElasticSearch index.

The class takes the array and splits it in chunks of configurable size, so it can insert the whole data array sending multiple requests to the ElasticSearch server.

The class can also connect to one or more possible server instances, so it can fallback to another server when the first one is not available for some reason.

Innovation Award
PHP Programming Innovation award nominee
July 2018
Number 5
ElasticSearch is a well know search engine software that can associate data documents with keys that are used for performing fast searches.

Often applications need to store in ElasticSearch large amounts of data to be searched.

This package provides a solution to reduce the time to insert large data record sets in an ElasticSearch server instance.

Manuel Lemos
Picture of Mostafa Abd-El-Hamid
  Performance   Level  
Name: Mostafa Abd-El-Hamid <contact>
Classes: 23 packages by
Country: Egypt Egypt
Age: 40
All time rank: 5595 in Egypt Egypt
Week rank: 89 Up1 in Egypt Egypt Up
Innovation award
Innovation award
Nominee: 5x


elasticsearchbulkinsertion (Future Mode)

Elastic Search Bulk Insertion Library

This class will seed the data into elastic search database using async requests and a PHP library called elasticsearch/elasticsearch


composer require mosta/bulkinsertion


1) Install elastic search library using composer:

     composer require elasticsearch/elasticsearch

2) Set the host and port number if needed

3) Set the memory limit of the execution of the function

4) Put the index name which is equivalent to database name in SQL

5) Put the type which is equivalent to the table name in SQL

6) Put the chunk size which is going to be the number of records

 elastic search will insert for each iteration
 This will affect the performance of the machine you will be using
 and elastic search machine.

7) Pass the data you want to insert into elastic search

## Example:

  use ElasticSearch\Seeder;
  $seeder = new ElasticSeeder;
    'host' => '',
    'port' => '9200'
    'dataKey1' => 'dataValue1',
    'dataKey2' => 'dataValue2'

  Files folder image Files  
File Role Description
Files folder imageElasticSearch (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  ElasticSearch  
File Role Description
Files folder imageSeeder (1 file)

  Files folder image Files  /  ElasticSearch  /  Seeder  
File Role Description
  Plain text file ElasticSeeder.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,473
This week:524Up