Python ElasticSearch
from elasticsearch import Elasticsearch
es = Elasticsearch('http://127.0.0.1:9200')
ix = ix_name # string
Search All Index
for index in es.indices.get('*'):
print(index)
Create Index
# 3 shards, 1 replicas
body={"settings" : {"index" : {"number_of_shards" : 3,"number_of_replicas" : 1 }}}
res = es.indices.create(index=ix, body=mapping)
print(res)
-----------------------------------------------------------------------------------
True or False
Index Exists
res = es.indices.exists(index=ix)
print(res)
-------------------------------------------------
True or False
Delete Index
res = es.indices.delete(index=ix, ,ignore=[400, 404])
print(res)
-------------------------------------------------
True or False
'Python > Python Programming' 카테고리의 다른 글
[ Python ] numpy를 이용한 1차원 배열 2 차원 배열로 변환 (0) | 2023.05.12 |
---|---|
[ Python ] 날짜형식의 문자열 타입을 datetime 타입 형식으로 변환 (0) | 2023.05.03 |
[ Python ] xml 타입의 데이터 json 으로 변경 (0) | 2023.04.24 |
[ Python ] difflib 모듈 ( 문자열 비교, 유사도 ) (0) | 2023.04.24 |
[ Python ] Remine API 사용하기 (0) | 2023.03.21 |
[ Python ] Tree Graph 만들기 (0) | 2023.02.15 |
[ Python ] eval과 literal_eval 차이 (0) | 2022.07.03 |
[ Python ] cx_Oracle을 이용한 oracle 연결 (0) | 2022.06.27 |