Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- Tutorial
- dense_vector
- framework
- PYTHON
- kibana
- Data Engineering
- Crontab
- node.js
- windows
- ubuntu
- ELK
- elasticsearch
- devtools
- package.json
- KoA
- CSV
- grok
- json
- logstash
- DSL
- venv
- typescript
- OPCUA
- configure
- elastic
- 7.7.1
- airflow
- query
- filebeat
- path.data
Archives
- Today
- Total
Gibbs Kim's playground
[ElasticStack-27] Elasticsearch msearch (with Python) 본문
Tech 기록지/Elastic Stack
[ElasticStack-27] Elasticsearch msearch (with Python)
Lio Grande 2020. 7. 23. 11:23Elasticsearch로 msearch를 수행할떄는 다음과 같은 패턴으로 작성을 하게 된다.
GET _msearch
{"index": "index1"}
{"query": {"match_all": {}}}
{"index": "index2"}
{"query": {"match_all": {}}}
{"index": "index3"}
{"query": {"match_all": {}}}
참고 링크
만약 위와 같은 쿼리를 Elasticsearch-python module을 활용하여 수행하고 싶다면 다음과 같이 작성하자.
from elasticsearch import Elasticsearch
es = Elasticsearch()
body = [ {"index": "index1"},
{"query": {"match_all": {}}},
{"index": "index2"},
{"query": {"match_all": {}}},
{"index": "index3"},
{"query": {"match_all": {}}}
]
res = es.msearch(body=body)
print(res)
msearch 결과를 cmd를 통해 확인 가능하다.
'Tech 기록지 > Elastic Stack' 카테고리의 다른 글
[ElasticStack-29] Elasticsearch 동의어 관리 방식 (2) | 2020.09.01 |
---|---|
[ElasticStack-28] search.max_buckets, max_result_window 사이즈 증가 (0) | 2020.08.18 |
[ElasticStack-26] ES data directory move (0) | 2020.07.10 |
[ElasticStack-25] dotProduct and sigmoid in elasticsearch (0) | 2020.07.01 |
[ElasticStack-24] elasticsearch & logstash template (shard setting) (0) | 2020.07.01 |