Code Monkey home page Code Monkey logo

laravel-docker-elasticsearch's Introduction

Laravel-docker-elasticsearch

This is a simple repo for practicing elasticsearch with laravel and docker.

What is Elasticsearch?

Elasticsearch is an open-source, RESTful, distributed search and analytics engine built on Apache Lucene. Since the first version of Elasticsearch was released in 2010, it has quickly become the most popular search engine, and is commonly used for log analytics, full-text search, and operational intelligence use cases.

In this repo you will get how you will use elasticsearch with laravel and docker.

First you have to add elastic search image in docker-compose file.

For Example :

elasticsearch:
      image: elasticsearch
      ports:
          - "9200:9200"

Before running docker compose you have to sure that docker memory size >= 4.0 GB. Otherwise, the elastic search will not run properly.

Now you have to update composer.json file.

"require": {      
        "elasticsearch/elasticsearch": "^5.2"  
    }

All the above things I have done in this repo. For running this project just follow the following step:

clone the repo 

From the project directory run the following command:

composer update

Now increase docker memory size, restart docker and run the following commands

docker-compose build

docker-compose up -d

Now run the migration commmand:

php artisan migrate

Now you can brows the project and create post from this url

http://localhost:9000/posts/create

Now you can search using elastic search. In app elastic folder you will get elastic class. Here I have implement elastic client.

If you want to add demo data for Post then run the following command:

docker-compose exec php php artisan tinker

factory(App\Post::class, 50)->create();

laravel-docker-elasticsearch's People

Contributors

nahidulhasan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.