-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Watcher: Ensure all internal search requests count hits (#36697)
In previous commits only the stored toXContent version of a search request was using the old format. However an executed search request was already disabling hit counts. In 7.0 hit counts will stay enabled by default to allow for proper migration. Closes #36177
- Loading branch information
Showing
6 changed files
with
152 additions
and
18 deletions.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
...n/src/test/resources/rest-api-spec/test/watcher/put_watch/91_search_total_hits_as_int.yml
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,115 @@ | ||
--- | ||
setup: | ||
- do: | ||
cluster.health: | ||
wait_for_status: yellow | ||
|
||
- do: | ||
index: | ||
index: my_test_index | ||
type: doc | ||
id: my_id | ||
refresh: true | ||
body: > | ||
{ | ||
"key": "value" | ||
} | ||
--- | ||
"Test search input includes hits by default": | ||
|
||
- do: | ||
xpack.watcher.execute_watch: | ||
body: > | ||
{ | ||
"watch" : { | ||
"trigger": { | ||
"schedule" : { "cron" : "0 0 0 1 * ? 2099" } | ||
}, | ||
"input": { | ||
"search" : { | ||
"request" : { | ||
"indices" : [ "my_test_index" ], | ||
"body" : { | ||
"query": { | ||
"match_all" : {} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"condition": { | ||
"compare": { | ||
"ctx.payload.hits.total": { | ||
"gt": 0 | ||
} | ||
} | ||
}, | ||
"actions": { | ||
"logging" : { | ||
"logging" : { | ||
"text" : "Logging from a test" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
- match: { watch_record.result.condition.met: true } | ||
|
||
|
||
--- | ||
"Test search transform includes hits by default": | ||
|
||
- do: | ||
xpack.watcher.execute_watch: | ||
body: > | ||
{ | ||
"watch" : { | ||
"trigger": { | ||
"schedule" : { "cron" : "0 0 0 1 * ? 2099" } | ||
}, | ||
"input": { | ||
"simple": { | ||
"foo": "bar" | ||
} | ||
}, | ||
"transform" : { | ||
"search" : { | ||
"request" : { | ||
"indices" : [ "my_test_index" ], | ||
"body" : { | ||
"query": { | ||
"match_all" : {} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"actions": { | ||
"indexme" : { | ||
"condition": { | ||
"compare": { | ||
"ctx.payload.hits.total": { | ||
"gt": 0 | ||
} | ||
} | ||
}, | ||
"index" : { | ||
"index" : "my_test_index", | ||
"doc_type" : "doc", | ||
"doc_id": "my-id" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
- do: | ||
get: | ||
index: my_test_index | ||
type: doc | ||
id: my_id | ||
|
||
- match: { _source.key: "value" } | ||
|
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