เทคนิคผมใช้ในงานจริง
แก้คำไทยที่ Elasticsearch ตัดผิด
ใส่ตัวแทนคำก่อนตัดคำ คำอย่าง เทรด พอดแคสต์ คอนเทนต์ จึงไม่ถูกหั่นครึ่ง และไฮไลต์ยังตรงตำแหน่งเดิม
คำสั่ง
curl -X PUT -H 'Content-Type: application/json' http://127.0.0.1:9200/demo-th -d '{"settings":{"analysis":{"char_filter":{"omf_words":{"type":"mapping","mappings":["เทรด=>trade","อินดิเคเตอร์=>indicator"]}},"analyzer":{"th":{"type":"custom","char_filter":["omf_words"],"tokenizer":"thai","filter":["lowercase"]}}}}}'ค้นหาและจัดข้อมูลกลาง10 นาที
