Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Let_s_Go_Talk__6__GoのLT会_.pdf
Search
虎の穴ラボ株式会社
January 19, 2023
Technology
0
81
Let_s_Go_Talk__6__GoのLT会_.pdf
Let's Go Talk #6 (GoのLT会)の発表資料になります。
https://connehito.connpass.com/event/270615/
虎の穴ラボ株式会社
January 19, 2023
Tweet
Share
More Decks by 虎の穴ラボ株式会社
See All by 虎の穴ラボ株式会社
FreshとHonoでDeno KVを使い倒す
toranoana
1
43
サブカル業界Developers_実践_開発業務でのAIの活用
toranoana
1
280
「エンジニアリングマネージャーのしごと」勉強してみた
toranoana
2
250
【OSC2024 Online/Spring】とらのあなラボの Deno イベント開催の取り組み
toranoana
0
280
【toranoana.deno#15】WebGPUで遊ぼう
toranoana
0
310
App Router による Web 開発について
toranoana
0
93
Fresh(Deno)をプラグインで拡張しよう!
toranoana
0
220
Freshプラグインのテストもプラグインを使うと捗る!
toranoana
0
120
個人開発アプリにスキーマ 駆動開発を取り入れた話
toranoana
0
80
Other Decks in Technology
See All in Technology
JSON攻略法.pdf
miyakemito
8
5k
Next'24 事例セッションの紹介とクラウド資格を活用したキャリア形成について語りMuscle
yasumuusan
1
440
Kernel MemoryでAzure OpenAI Serviceとお手軽データソース連携
mitsuzono
1
240
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
180
20分で完全に理解するGrafanaダッシュボード
hamadakoji
3
410
VSCodeの拡張機能を作っている話
ebarakazuhiro
1
350
AWSに詳しくない人でも始められるコスト最適化ガイド
yuhta28
0
190
Azureの基本的な権限管理の勉強会
yhana
0
190
On Your Data を超えていく!
hirotomotaguchi
2
670
Meta Quest 3 で動く桜マシマシ WebXR アプリを IBM Cloud Code Engine と Babylon.js で作った話
1ftseabass
PRO
0
120
Postman v10リリース後を振り返る / Looking back at Postman v10 after release
yokawasa
1
160
ゼロから始めるVue.jsコミュニティ貢献 / first-vuejs-community-contribution-link-and-motivation
lmi
1
120
Featured
See All Featured
Unsuck your backbone
ammeep
663
57k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.9k
Statistics for Hackers
jakevdp
789
220k
Making Projects Easy
brettharned
108
5.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
31
46k
What's in a price? How to price your products and services
michaelherold
237
11k
Teambox: Starting and Learning
jrom
128
8.4k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
104
6.6k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
Optimising Largest Contentful Paint
csswizardry
8
2.4k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
Transcript
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. GoからOpenSearchServiceを 使ってみる
虎の穴ラボ株式会社 浜田拓実 (sheltie) 2023 Let's Go Talk #6 (GoのLT会)
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. 自己紹介 浜田
拓実(ハマダ タクミ) • 2022/06 入社 • 虎の穴ラボ 通販チーム エンジニア Goを始めたきっかけ • 社内勉強会でGoが取り上げられた • 昨年末よりGoでWebアプリを作り始める
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. アジェンダ •
作成物の概要 • OpenSearchについて • ドキュメントの登録 • ドキュメントの検索 • 注意点 • まとめ
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. 作成物の概要 ・楽天APIから商品情報を日次で取得
・取得データをOpenSearchに登録 ・キーワードでOpenSearchを検索 GoとOpenSearchの練習のため作成
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. OpenSearchについて
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. OpenSearchについて OpenSearchとは・・・
• ElasticSearchをフォークして 開発が行われている • データ検索、分析、可視化が可能。 • 100%オープンソース
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. OpenSearchについて Goから利用する
• 公式から環境構築のDockerサンプルが 提供されている • Go クライアントが提供されている
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. OpenSearchについて Dockerサンプル
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. Goから利用する (ドキュメントの登録)
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. ドキュメントの登録 公式サンプルを利用する
• Goクライアントを利用した実装例 • CRUD操作を一通り実施
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. ドキュメントの登録 APIはJSON形式でやりとり
• APIのパラメータに適した 構造体の定義 • json.Marshal / Unmarshalを利用 • JSON-to-GoでJSONを構造体に変換 https://mholt.github.io/json-to-go/
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. ドキュメントの登録 実際の実装内容
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. Goから利用する (ドキュメントの検索)
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. ドキュメントの検索 公式サンプルを利用する
• こちらもJSON形式でやりとり • 独特な検索クエリに慣れる必要あり
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. ドキュメントの検索 実際の実装内容(前半)
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. ドキュメントの検索 実際の実装内容(後半)
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. 注意点
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. 注意点 大量のドキュメントをループで登録中、以下のようなエラーが発生
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. 注意点 公式サンプルとの相違点
• 更新サンプルはレスポンスを 閉じる処理が省略されている • Go Packagesのサンプルでは レスポンスを閉じる処理有り レスポンスを閉じないと、 先ほどのエラーが発生するため注意
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. まとめ
Copyright (C) 2020 Toranoana Inc. All Rights Reserved. まとめ GoからOpenSearchを取り扱うのは比較的簡単
・OpenSearch、Go共にサンプルが充実 ・Goクライアントが用意されている ・GoとJSONの相性が良い(気がする) OpenSearchはGoと相性の良い 検索エンジンだと感じました