Created
May 2, 2025 03:41
-
-
Save arofiqimaulana/8771142a63968f884bbd73985cc73cf9 to your computer and use it in GitHub Desktop.
Contoh elastic kedua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "size": 10, | |
| "query": { | |
| "bool": { | |
| "should": [ | |
| { | |
| "multi_match": { | |
| "query": "kopi manis", | |
| "fields": [ | |
| "deskripsi^3", // Boost 3 untuk deskripsi | |
| "bentuk^2", // Boost 2 untuk bentuk | |
| "warna^2" // Boost 2 untuk warna | |
| ], | |
| "type": "most_fields", // Pencarian ini akan mempertimbangkan semua field yang ada dalam query | |
| "minimum_should_match": "2" // Minimal dua kata dalam query harus cocok | |
| } | |
| }, | |
| { | |
| "match_phrase": { | |
| "bentuk": { | |
| "query": "kopi", | |
| "slop": 2, // Fleksibilitas dua kata antar kata untuk pencocokan frasa | |
| "boost": 3 // Meningkatkan skor jika cocok di bentuk | |
| } | |
| } | |
| }, | |
| { | |
| "match_phrase": { | |
| "warna": { | |
| "query": "coklat", | |
| "slop": 2, // Fleksibilitas dua kata antar kata | |
| "boost": 2 // Meningkatkan skor jika cocok di warna | |
| } | |
| } | |
| } | |
| ], | |
| "minimum_should_match": 1 // Minimal satu kondisi dari 'should' harus cocok | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment