Last active
September 9, 2023 09:00
-
-
Save hkulekci/53d15322dd83b18d14e126207c8b51ff to your computer and use it in GitHub Desktop.
Revisions
-
hkulekci revised this gist
Sep 9, 2023 . 1 changed file with 32 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -76,4 +76,36 @@ GET job-candidates/_search } } } PUT /job-candidates/_doc/5?refresh { "name": "Mason Difficult", "programming_languages": [ "java", "php"] } GET /job-candidates/_search { "query": { "terms_set": { "programming_languages": { "terms": [ "java", "php" ], "minimum_should_match_script": { "source": """ if (doc['required_matches'].size() != 0) { params['min_requires'] = doc['required_matches'].value } return params['min_requires']; """, "params": { "min_requires": 2 } } } } } } ``` -
hkulekci revised this gist
Sep 9, 2023 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ ``` DELETE job-candidates PUT job-candidates @@ -74,4 +75,5 @@ GET job-candidates/_search } } } } ``` -
hkulekci created this gist
Sep 9, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,77 @@ DELETE job-candidates PUT job-candidates { "mappings": { "properties": { "name": { "type": "keyword" }, "programming_languages": { "type": "keyword" }, "required_matches": { "type": "long" } } } } PUT job-candidates/_doc/1?refresh { "name": "Jane Smith", "programming_languages": [ "c++", "java" ], "required_matches": 2 } PUT job-candidates/_doc/2?refresh { "name": "Jason Response", "programming_languages": [ "java", "php" ], "required_matches": 2 } PUT /job-candidates/_doc/3?refresh { "name": "Jason Request", "programming_languages": [ "rust", "php" ], "required_matches": 1 } PUT /job-candidates/_doc/4?refresh { "name": "Mason Difficult", "programming_languages": [ "javascript", "php", "html"], "required_matches": 3 } GET job-candidates/_search GET job-candidates/_search { "query": { "terms_set": { "programming_languages": { "terms": ["c++", "java", "php"], "minimum_should_match_field": "required_matches" } } } } GET job-candidates/_search { "query": { "terms_set": { "programming_languages": { "terms": ["java", "php"], "minimum_should_match_field": "required_matches" } } } }