Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 842 Bytes

elasticsearch.md

File metadata and controls

46 lines (29 loc) · 842 Bytes
description
Frequently used code for Elasticsearch

Elasticsearch

Using httpie library for the requests

Create an Index

http PUT HOST:PORT/{index-name}/_alias/{alias-name}

Check if index exists

http GET HOST:PORT/{index-name}
# The resultant status code would tell if found(200, or 404)

Get index with a given alias

http GET HOST:PORT/_alias/{alias-name}

Delete an Index

http DELETE HOST:PORT/{index-name}

Example of search

# using httpie
http elasticsearch2:9200/ascendsport-en/_search?_source="question,_id,answer" Content-Type:application/json query:='{"match": {"question": "what is telegram"}}'

References