Skip to content

Commit

Permalink
Merge pull request #62 from o19s/removing-query-results-index
Browse files Browse the repository at this point in the history
Removing indexing of query results to second index
  • Loading branch information
jzonthemtn authored Dec 11, 2024
2 parents d7d6bf4 + 7d8b26e commit bb82ea4
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 41 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ID_FIELD="asin"
K="20"
THRESHOLD="1.0" # Default value

curl -s -X DELETE "http://localhost:9200/search_quality_eval_query_sets_run_results,sqe_metrics_sample_data"
curl -s -X DELETE "http://localhost:9200/sqe_metrics_sample_data"

# Keyword search
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}" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ public class SearchQualityEvaluationPlugin extends Plugin implements ActionPlugi
*/
public static final String QUERY_SETS_INDEX_NAME = "search_quality_eval_query_sets";

/**
* The name of the index that stores the query set run results.
*/
public static final String QUERY_SETS_RUN_RESULTS_INDEX_NAME = "search_quality_eval_query_sets_run_results";

/**
* The name of the index that stores the metrics for the dashboard.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
import org.apache.logging.log4j.Logger;
import org.opensearch.action.admin.indices.create.CreateIndexRequest;
import org.opensearch.action.admin.indices.create.CreateIndexResponse;
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsAction;
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsRequest;
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.opensearch.action.bulk.BulkRequest;
import org.opensearch.action.bulk.BulkResponse;
import org.opensearch.action.index.IndexRequest;
import org.opensearch.action.index.IndexResponse;
import org.opensearch.action.search.SearchRequest;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.client.Client;
Expand All @@ -40,7 +38,6 @@
import java.util.Map;
import java.util.UUID;

import static org.opensearch.eval.SearchQualityEvaluationPlugin.JUDGMENTS_INDEX_NAME;
import static org.opensearch.eval.SearchQualityEvaluationRestHandler.QUERY_PLACEHOLDER;

/**
Expand Down Expand Up @@ -186,35 +183,6 @@ public void onFailure(Exception ex) {
@Override
public void save(final QuerySetRunResult result) throws Exception {

// Index the query results into OpenSearch.

final Map<String, Object> results = new HashMap<>();

results.put("run_id", result.getRunId());
results.put("query_results", result.getQueryResultsAsMap());

// Add each metric to the object to index.
for (final String metric : result.getSearchMetrics().keySet()) {
results.put(metric, result.getSearchMetrics().get(metric));
}

final IndexRequest indexRequest = new IndexRequest(SearchQualityEvaluationPlugin.QUERY_SETS_RUN_RESULTS_INDEX_NAME)
.id(UUID.randomUUID().toString())
.source(results);

client.index(indexRequest).get();
// client.index(indexRequest, new ActionListener<>() {
// @Override
// public void onResponse(IndexResponse indexResponse) {
// LOGGER.debug("Query set results indexed.");
// }
//
// @Override
// public void onFailure(Exception ex) {
// throw new RuntimeException(ex);
// }
// });

// Now, index the metrics as expected by the dashboards.

// See https://github.com/o19s/opensearch-search-quality-evaluation/blob/main/opensearch-dashboard-prototyping/METRICS_SCHEMA.md
Expand Down

0 comments on commit bb82ea4

Please sign in to comment.