- mariadb 계정
- mysql 실행파일 경로
- DB명 : sample1_dev
- npm install
- pip install -r requirements/dev.txt
- /c/xampp/mysql/bin/mysql -u sbsst -psbs123414 -e "DROP DATABASE IF EXISTS sample1_dev; CREATE DATABASE sample1_dev"
- mariadb 실행
- npm run css
- 다른 터미널 열기
- ./manage.py migrate
- ./manage.py runserver 0.0.0.0:8000
- /c/xampp/mysql/bin/mysql -u sbsst -psbs123414 -e "DROP DATABASE IF EXISTS sample1_dev; CREATE DATABASE sample1_dev"
- /c/xampp/mysql/bin/mysql -u sbsst -psbs123414 -e "DROP DATABASE IF EXISTS sample1_dev; CREATE DATABASE sample1_dev" && ./manage.py migrate
- /c/xampp/mysql/bin/mysql -u sbsst -psbs123414 -e "DROP DATABASE IF EXISTS sample1_dev; CREATE DATABASE sample1_dev" && ./manage.py migrate && ./manage.py runserver 0.0.0.0:8000
- DB 초기화 명령어 && 마이그레이트 && 서버실행
인덱스 깔끔하게 지우고 MySQL의 모든 데이터를 처음부터 다시 인덱스에 넣는 방법
- 로그스태시의 sql_last_value 값 클리어
- 로그스태시만 리스타트
- 키바나에서, 인덱스 삭제, 인덱스 세팅, 인덱스 매핑 세팅
- 자세한 내용은 엘라스틱 서치 개발환경 세팅, wiken.io/ken/3374, 16강 ~ 18강 참고
DELETE /sample1_dev___products_product_type_1___v1
PUT /sample1_dev___products_product_type_1___v1
{
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"analysis": {
"analyzer": {
"nori_analyzer": {
"type": "custom",
"tokenizer": "nori_tokenizer",
"filter": "nori_filter"
}
},
"tokenizer": {
"nori_tokenizer": {
"type": "nori_tokenizer",
"decompound_mode": "discard",
"user_dictionary": "dict.txt"
}
},
"filter": {
"nori_filter": {
"type": "nori_part_of_speech",
"stoptags": [
"E", "IC", "J", "MAG", "MAJ", "MM", "SP", "SSC", "SSO", "SC", "SE", "XPN", "XSA", "XSN", "XSV", "UNA", "NA", "VSV"
]
}
}
}
}
}
첫번째 인덱스의 타입 설정(엘라스틱 서치 7.0 부터 인덱스에 타입 1개만 설정 가능)
PUT /sample1_dev___products_product_type_1___v1/_mappings
{
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "keyword",
"copy_to": [ "name_nori"]
},
"name_nori": {
"type": "text",
"analyzer": "nori_analyzer"
},
"display_name": {
"type": "keyword",
"copy_to": [ "display_name_nori"]
},
"display_name_nori": {
"type": "text",
"analyzer": "nori_analyzer"
},
"description": {
"type": "keyword",
"copy_to": [ "display_name_nori"]
},
"description_nori": {
"type": "text",
"analyzer": "nori_analyzer"
},
"cate_item_id": {
"type": "integer"
},
"market_id": {
"type": "integer"
},
"price": {
"type": "integer"
},
"sale_price": {
"type": "integer"
}
}
}
GET /sample1_dev___products_product_type_1___v1
GET _sql?format=json
{
"query": """
SELECT COUNT(*) FROM sample1_dev___products_product_type_1___v1
"""
}
GET _sql?format=json
{
"query": """
SELECT * FROM sample1_dev___products_product_type_1___v1
"""
}
DELETE /sample1_dev___products_product_type_2___v1
PUT /sample1_dev___products_product_type_2___v1
{
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"analysis": {
"analyzer": {
"nori_analyzer": {
"type": "custom",
"tokenizer": "nori_tokenizer",
"filter": "nori_filter"
}
},
"tokenizer": {
"nori_tokenizer": {
"type": "nori_tokenizer",
"decompound_mode": "discard",
"user_dictionary": "dict.txt"
}
},
"filter": {
"nori_filter": {
"type": "nori_part_of_speech",
"stoptags": [
"E", "IC", "J", "MAG", "MAJ", "MM", "SP", "SSC", "SSO", "SC", "SE", "XPN", "XSA", "XSN", "XSV", "UNA", "NA", "VSV"
]
}
}
}
}
}
PUT /sample1_dev___products_product_type_2___v1/_mappings
{
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "keyword",
"copy_to": [ "name_nori"]
},
"name_nori": {
"type": "text",
"analyzer": "nori_analyzer"
},
"display_name": {
"type": "keyword",
"copy_to": [ "display_name_nori"]
},
"display_name_nori": {
"type": "text",
"analyzer": "nori_analyzer"
},
"description": {
"type": "keyword",
"copy_to": [ "description_nori"]
},
"description_nori": {
"type": "text",
"analyzer": "nori_analyzer"
},
"market_name": {
"type": "keyword",
"copy_to": [ "market_name_nori"]
},
"market_name_nori": {
"type": "text",
"analyzer": "nori_analyzer"
},
"cate_item_name": {
"type": "keyword",
"copy_to": [ "cate_item_name_nori"]
},
"cate_item_name_nori": {
"type": "text",
"analyzer": "nori_analyzer"
},
"price": {
"type": "integer"
},
"sale_price": {
"type": "integer"
}
}
}
GET /sample1_dev___products_product_type_2___v1
GET _sql?format=json
{
"query": """
SELECT COUNT(*) FROM sample1_dev___products_product_type_2___v1
"""
}
GET _sql?format=json
{
"query": """
SELECT * FROM sample1_dev___products_product_type_2___v1
"""
}