tips chips

日々の作業で出てきた技術メモの切れ端を置いておくページ

Elasticsearchでよく使うAPIのメモ

ちょろっとESのAPIをcurlとかで叩くときの個人的チートシート

個人的に頻出のやつ

REST APIs | Elasticsearch Guide [8.13] | Elastic
https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html

Index一覧

GET /_cat/indices

indicesの綴りが何回やっても覚えられん

とりあえずDoc入っているか見る

GET /<index>/_search

なにも渡さずに叩けば返ってくる

Index消す

DELETE /<index>

search templateを登録

echo <search template> | curl -X PUT http://localhost:9200/_scripts/<index> -d @- -H 'Content-Type: application/json'

@-というのは標準入力から受け取っているだけなのでよしなに

search templateを見る

GET /_scripts/<script>

search templateを使う

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template-api.html

GET /<index>/_search/template

{ "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 } }

これめちゃくちゃ忘れる