-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting judgments for metrics calculation. Improving error handling and validation. #50
Merged
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
596ef60
Getting judgments for metrics calculation. Improving error handling a…
jzonthemtn 2bef701
Moving getJudgments to abstract class.
jzonthemtn a6315fb
Working on calculating DCG.
jzonthemtn 9607f81
Changing how judgments are indexed.
jzonthemtn 07861f6
Indexing judgments as individual documents.
jzonthemtn 8dc72e9
Querying to get judgments.
jzonthemtn e0e7cd5
Renaming queryResponseObjectIds to queryResponseHitIds.
jzonthemtn c47c191
Updating ubi plugin to 2.18.0.2
jzonthemtn cec6de1
Removing non-working standalone project.
jzonthemtn 8d80e2e
Separating out the metrics.
jzonthemtn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
#!/bin/bash -e | ||
|
||
echo "Deleting existing ubi_events and ubi_queries indexes..." | ||
curl -s -X DELETE "http://localhost:9200/ubi_queries,ubi_events" | ||
|
||
echo "Initializing UBI..." | ||
curl -s -X POST "http://localhost:9200/_plugins/ubi/initialize" | ||
|
||
echo "Indexing queries and events..." | ||
curl -s -X POST "http://localhost:9200/_bulk?pretty" -H "Content-Type: application/x-ndjson" --data-binary @ubi_queries_events.ndjson |
3 changes: 3 additions & 0 deletions
3
opensearch-search-quality-evaluation-plugin/scripts/delete-query-sets.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash -e | ||
|
||
curl -s -X DELETE "http://localhost:9200/search_quality_eval_query_sets" |
4 changes: 4 additions & 0 deletions
4
opensearch-search-quality-evaluation-plugin/scripts/get-judgments.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#!/bin/bash -e | ||
|
||
JUDGMENT_ID=$1 | ||
|
||
#curl -s "http://localhost:9200/judgments/_doc/${JUDGMENT_ID}" | jq | ||
|
||
curl -s "http://localhost:9200/judgments/_search" | jq |
16 changes: 9 additions & 7 deletions
16
opensearch-search-quality-evaluation-plugin/scripts/run-query-set.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
#!/bin/bash -e | ||
|
||
QUERY_SET_ID="${1}" | ||
JUDGMENTS_ID="12345" | ||
JUDGMENTS_ID="669fc8aa-3fe7-418f-952b-df7354af8f37" | ||
INDEX="ecommerce" | ||
ID_FIELD="asin" | ||
K="10" | ||
|
||
curl -s -X DELETE "http://localhost:9200/search_quality_eval_query_sets_run_results" | ||
|
||
curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/run?id=${QUERY_SET_ID}&judgments_id=${JUDGMENTS_ID}&index=${INDEX}&id_field=${ID_FIELD}&k=${K}" \ | ||
-H "Content-Type: application/json" \ | ||
--data-binary '{ | ||
"query": { | ||
"match": { | ||
"description": { | ||
"query": "#$query##" | ||
"query": { | ||
"match": { | ||
"description": { | ||
"query": "#$query##" | ||
} | ||
} | ||
} | ||
} | ||
}' | ||
}' |
21 changes: 21 additions & 0 deletions
21
opensearch-search-quality-evaluation-plugin/scripts/walkthrough.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash -e | ||
|
||
# Example walkthrough end-to-end for the plugin. | ||
|
||
# Delete existing UBI indexes and create new ones. | ||
curl -s -X DELETE "http://localhost:9200/ubi_queries,ubi_events" | ||
curl -s -X POST "http://localhost:9200/_plugins/ubi/initialize" | ||
|
||
# IMPORTANT: Now index data (UBI and ESCI). | ||
|
||
# Create judgments. | ||
curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/judgments?click_model=coec&max_rank=20" | ||
|
||
# Create a query set. | ||
curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/queryset?name=test&description=fake&sampling=pptss&query_set_size=100" | ||
|
||
# Run the query set. | ||
./run-query-set.sh ${QUERY_SET_ID} | ||
|
||
# Look at the results. | ||
curl -s "http://localhost:9200/search_quality_eval_query_sets_run_results/_search" | jq |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,12 +36,16 @@ | |
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
import static org.opensearch.eval.SearchQualityEvaluationPlugin.JUDGMENTS_INDEX_NAME; | ||
import static org.opensearch.eval.SearchQualityEvaluationPlugin.UBI_EVENTS_INDEX_NAME; | ||
import static org.opensearch.eval.SearchQualityEvaluationPlugin.UBI_QUERIES_INDEX_NAME; | ||
import static org.opensearch.eval.judgments.clickmodel.coec.CoecClickModel.INDEX_JUDGMENTS; | ||
import static org.opensearch.eval.judgments.clickmodel.coec.CoecClickModel.INDEX_QUERY_DOC_CTR; | ||
import static org.opensearch.eval.judgments.clickmodel.coec.CoecClickModel.INDEX_RANK_AGGREGATED_CTR; | ||
|
||
/** | ||
* Functionality for interacting with OpenSearch. | ||
* TODO: Move these functions out of this class. | ||
*/ | ||
public class OpenSearchHelper { | ||
|
||
private static final Logger LOGGER = LogManager.getLogger(OpenSearchHelper.class.getName()); | ||
|
@@ -329,7 +333,7 @@ public String indexJudgments(final Collection<Judgment> judgments) throws Except | |
final Map<String, Object> judgmentsSource = new HashMap<>(); | ||
judgmentsSource.put("judgments", j); | ||
|
||
final IndexRequest indexRequest = new IndexRequest(INDEX_JUDGMENTS) | ||
final IndexRequest indexRequest = new IndexRequest(JUDGMENTS_INDEX_NAME) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JUDGEMENTS_INDEX_NAME ;-). J/k. |
||
.id(judgmentsId) | ||
.source(judgmentsSource); | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wonder if we shoulid call this dir
sample-data
to reflect that it isn't "real data shipped with the plugin"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. This is kind of what sparked my thought about having data external. I don't want another repo, but it's almost to the point where putting data somewhere else would be helpful.