설치: 설치가 가장 어려움
현재 Elastic Search를 6버전으로 설치해서, pip에서도 6버전으로 다운로드가 필요함...
elasticsearch6 6.8.2
elasticsearch6-dsl 6.4.0
위의 버전을 pip install로 설치하면 됨(버전 생략가능)
from datetime import datetime
# from collections import Mapping
from elasticsearch6 import Elasticsearch
es = Elasticsearch("http://localhost:9200")
# doc = {
# 'author': 'kimchi',
# 'text': 'Elasticsearch: cool bossam kimchi',
# 'timestamp': datetime.now(),
# }
es.indices.create(index='my-index', ignore=400)
# resp = es.index(index="my-index", doc_type="test_type", id=42, body=doc)
# print(resp['result'])
print(es.get(index="my-index", doc_type="test_type", id=42))
외국 예제인데, 한국 김치가 역시 세계적이긴 한가봄
갑자기 보쌈 김치가 먹고 싶어짐...
'python' 카테고리의 다른 글
| Chatgpt Completion create 메소드 정리 (0) | 2023.11.16 |
|---|---|
| Python + ChatGPT(gpt-3.5-turbo용으로 변경) (0) | 2023.11.16 |
| Chat GPT + Python (1) | 2023.11.09 |
| FastApi + ElasticSearch로 간단한 영화검색 만들기 (0) | 2023.07.30 |
| 엘라스틱 서치: Nori 토크나이저를 사용한 검색(python 연결) (0) | 2023.07.29 |
