Skip to content
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

Adding timestamp to search events #42

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public void persistQuery(final String storeName, final QueryRequest queryRequest

// What will be indexed - adheres to the queries-mapping.json
final Map<String, Object> source = new HashMap<>();
source.put("timestamp", queryRequest.getTimestamp());
source.put("queryId", queryRequest.getQueryId());
source.put("query", queryRequest.getQuery());
source.put("queryResponseId", queryResponse.getQueryResponseId());
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/opensearch/ubl/model/QueryRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@

public class QueryRequest {

private final long timestamp;
private final String queryId;
private final String query;

public QueryRequest(final String queryId, final String query) {
this.timestamp = System.currentTimeMillis();
this.queryId = queryId;
this.query = query;
}

public long getTimestamp() {
return timestamp;
}

public String getQueryId() {
return queryId;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"dynamic": false,
"properties": {
"timestamp": {
"type": "date"
},
"queryId": {
"type": "keyword"
},
Expand Down
Loading