Skip to content

2. Configuration (Laravel & Lumen)

Basem Khirat edited this page Feb 7, 2018 · 2 revisions

After publishing, two configuration files will be created.

  • config/es.php where you can add more than one elasticsearch server.
# Here you can define the default connection name.

'default' => env('ELASTIC_CONNECTION', 'default'),

# Here you can define your connections.

'connections' => [
	'default' => [
	    'servers' => [
	        [
	            "host" => env("ELASTIC_HOST", "127.0.0.1"),
	            "port" => env("ELASTIC_PORT", 9200),
	            'user' => env('ELASTIC_USER', ''),
	            'pass' => env('ELASTIC_PASS', ''),
	            'scheme' => env('ELASTIC_SCHEME', 'http'),
	        ]
	    ],
	    'index' => env('ELASTIC_INDEX', 'my_index')
	]
],
 
# Here you can define your indices.
 
'indices' => [
	'my_index_1' => [
	    "aliases" => [
	        "my_index"
	    ],
	    'settings' => [
	        "number_of_shards" => 1,
	        "number_of_replicas" => 0,
	    ],
	    'mappings' => [
	        'posts' => [
                    'properties' => [
                        'title' => [
                            'type' => 'string'
                        ]
                    ]
	        ]
	    ]
	]
]
  • config/scout.php where you can use package as a laravel scout driver.
Clone this wiki locally