-
Notifications
You must be signed in to change notification settings - Fork 113
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
Search Rollup and Live Data Feature: Base case (No overlapping data) #898
Closed
ronnaksaxena
wants to merge
8
commits into
opensearch-project:feature/rollup-and-live-search-2.9
from
ronnaksaxena:baseCase
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9cb12d8
added response interceptor
ronnaksaxena 69c7596
Base case: Query Live and Rollup data with no overlap
ronnaksaxena 351cd91
finished base case and added integ test
ronnaksaxena 7c7165b
Update IndexManagementPlugin.kt
ronnaksaxena 5b7406e
Update IndexManagementPlugin.kt
ronnaksaxena 6d82554
Delete ResponseInterceptor.kt
ronnaksaxena c258896
Update RollupInterceptor.kt
ronnaksaxena 42cc770
changed variable name to concreteRolledUpIndexNames
ronnaksaxena 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
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 |
---|---|---|
|
@@ -1876,4 +1876,82 @@ class RollupInterceptorIT : RollupRestTestCase() { | |
Assert.assertTrue(e.message!!.contains("Can't parse query_string query without sourceIndex mappings!")) | ||
} | ||
} | ||
fun `test search a live index and rollup index with no overlap`() { | ||
generateNYCTaxiData("source_rollup_search") | ||
val rollup = Rollup( | ||
id = "basic_term_query_rollup_search", | ||
enabled = true, | ||
schemaVersion = 1L, | ||
jobSchedule = IntervalSchedule(Instant.now(), 1, ChronoUnit.MINUTES), | ||
jobLastUpdatedTime = Instant.now(), | ||
jobEnabledTime = Instant.now(), | ||
description = "basic search test", | ||
sourceIndex = "source_rollup_search", | ||
targetIndex = "target_rollup_search", | ||
metadataID = null, | ||
roles = emptyList(), | ||
pageSize = 10, | ||
delay = 0, | ||
continuous = false, | ||
dimensions = listOf( | ||
DateHistogram(sourceField = "tpep_pickup_datetime", fixedInterval = "1h"), | ||
Terms("RatecodeID", "RatecodeID"), | ||
Terms("PULocationID", "PULocationID") | ||
), | ||
metrics = listOf( | ||
RollupMetrics( | ||
sourceField = "passenger_count", targetField = "passenger_count", | ||
metrics = listOf( | ||
Sum(), Min(), Max(), | ||
ValueCount(), Average() | ||
) | ||
), | ||
RollupMetrics(sourceField = "total_amount", targetField = "total_amount", metrics = listOf(Max(), Min())) | ||
) | ||
).let { createRollup(it, it.id) } | ||
|
||
updateRollupStartTime(rollup) | ||
|
||
waitFor { | ||
val rollupJob = getRollup(rollupId = rollup.id) | ||
assertNotNull("Rollup job doesn't have metadata set", rollupJob.metadataID) | ||
val rollupMetadata = getRollupMetadata(rollupJob.metadataID!!) | ||
assertEquals("Rollup is not finished", RollupMetadata.Status.FINISHED, rollupMetadata.status) | ||
} | ||
|
||
refreshAllIndices() | ||
|
||
// Delete values from live index | ||
var deleteResponse = client().makeRequest( | ||
"POST", | ||
"source_rollup_search/_delete_by_query", | ||
mapOf("refresh" to "true"), | ||
StringEntity("""{"query": {"match_all": {}}}""", ContentType.APPLICATION_JSON) | ||
) | ||
Comment on lines
+1925
to
+1930
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. If all the data from source index gets deleted, then it seems to me you are just search the rollup index later instead of both indexes |
||
assertTrue(deleteResponse.restStatus() == RestStatus.OK) | ||
// Term query | ||
var req = """ | ||
{ | ||
"size": 0, | ||
"query": { | ||
"match_all": {} | ||
}, | ||
"aggs": { | ||
"sum_passenger_count": { | ||
"sum": { | ||
"field": "passenger_count" | ||
} | ||
} | ||
} | ||
} | ||
""".trimIndent() | ||
var searchResponse = client().makeRequest("POST", "/target_rollup_search,source_rollup_search/_search", emptyMap(), StringEntity(req, ContentType.APPLICATION_JSON)) | ||
assertTrue(searchResponse.restStatus() == RestStatus.OK) | ||
var responseAggs = searchResponse.asMap()["aggregations"] as Map<String, Map<String, Any>> | ||
assertEquals( | ||
"Aggregation from searching both indices is wrong", | ||
9024.0, | ||
responseAggs.getValue("sum_passenger_count")["value"] | ||
) | ||
} | ||
} |
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.
When the shard is a rollup index, you do a filtering and keep only the rollup indexes in the request. What about the other path, when the shard is a live index, do you also need a filtering?