Skip to content

Inserting, updating data from mysql to elastic. And Elastic search with relevance.

Notifications You must be signed in to change notification settings

mmilojevic/elastic-mysql-data-manipulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Application for manipulating data between mysql and elastic. Used technologies" php 7.2.13 mysql 5.7.25 elastic 6.2.2

Installation

Clone the application

Run composer install in the root

Create in mysql database with command create database application default charset utf8;

Import video.sql with command: mysql -u root -proot application < schemas/video.sql

Create Elastic index with command:

PUT application
{
   "mappings": {
         "video": {
            "properties": {
                "id": {
                  "type": "long"
               },
               "title": {
                  "type": "text"
               },
               "description": {
                  "type": "text"
               },
               "actors": {
                  "type": "text"
               },
               "categories": {
                  "type": "text"
               },
               "tags": {
                  "type": "text"
               },
               "date": {
                  "type": "date",
                  "format": "yyyy-MM-dd HH:mm:ss"
               }
            }
         }
      }
}

Usage

Inserting all data from mysql to elastic: php src/index.php insert_all

Inserting latest data from mysql to elastic: php src/index.php insert_latest

Updating some videos. php index.php update 1 2 45 85

Where 1 2 45 85 represents video ids

Searching videos php index.php search "thought dolores" 450 1

Where

  • "thought dolores" is search string
  • 450 is offset
  • 1 is size

About

Inserting, updating data from mysql to elastic. And Elastic search with relevance.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages