Elasticsearch로 검색 기능을 구현하고 싶은데 기본 사용법을 알려주세요.
Elasticsearch 기본:
# Docker로 설치docker run -d -p 9200:9200 -e "discovery.type=single-node" elasticsearch:8.5.0# 인덱스 생성curl -X PUT "localhost:9200/posts" -H "Content-Type: application/json" -d '{ "mappings": { "properties": { "title": { "type": "text", "analyzer": "standard" }, "content": { "type": "text" }, "created_at": { "type": "date" } } }}'# 문서 추가curl -X POST "localhost:9200/posts/_doc" -H "Content-Type: application/json" -d '{ "title": "Elasticsearch 시작하기", "content": "검색 엔진 기본 사용법", "created_at": "2022-09-15"}'# 검색curl "localhost:9200/posts/_search?q=검색"
한국어 검색을 위해서는 nori 플러그인(한국어 형태소 분석기)을 설치하세요.
댓글 1
Elasticsearch 기본:
한국어 검색을 위해서는 nori 플러그인(한국어 형태소 분석기)을 설치하세요.