Renamed `email.email` to `email.message` in the email action result.
Closes elastic/elasticsearch#592 Original commit: elastic/x-pack-elasticsearch@043a4084e6
This commit is contained in:
parent
4c6d709bca
commit
bcb7428868
|
@ -86,4 +86,4 @@
|
||||||
- match: { "watch_record.result.actions.0.id" : "email_admin" }
|
- match: { "watch_record.result.actions.0.id" : "email_admin" }
|
||||||
- match: { "watch_record.result.actions.0.status" : "simulated" }
|
- match: { "watch_record.result.actions.0.status" : "simulated" }
|
||||||
- match: { "watch_record.result.actions.0.type" : "email" }
|
- match: { "watch_record.result.actions.0.type" : "email" }
|
||||||
- match: { "watch_record.result.actions.0.email.email.subject" : "404 recently encountered" }
|
- match: { "watch_record.result.actions.0.email.message.subject" : "404 recently encountered" }
|
||||||
|
|
|
@ -71,4 +71,4 @@
|
||||||
- match: { "watch_record.result.condition.met": true }
|
- match: { "watch_record.result.condition.met": true }
|
||||||
- match: { "watch_record.result.actions.0.id" : "email_admin" }
|
- match: { "watch_record.result.actions.0.id" : "email_admin" }
|
||||||
- match: { "watch_record.result.actions.0.status" : "simulated" }
|
- match: { "watch_record.result.actions.0.status" : "simulated" }
|
||||||
- match: { "watch_record.result.actions.0.email.email.subject" : "404 recently encountered" }
|
- match: { "watch_record.result.actions.0.email.message.subject" : "404 recently encountered" }
|
||||||
|
|
|
@ -192,7 +192,7 @@ public class EmailAction implements Action {
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
return builder.startObject(type)
|
return builder.startObject(type)
|
||||||
.field(Field.ACCOUNT.getPreferredName(), account)
|
.field(Field.ACCOUNT.getPreferredName(), account)
|
||||||
.field(Field.EMAIL.getPreferredName(), email, params)
|
.field(Field.MESSAGE.getPreferredName(), email, params)
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ public class EmailAction implements Action {
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
return builder.startObject(type)
|
return builder.startObject(type)
|
||||||
.field(Field.EMAIL.getPreferredName(), email, params)
|
.field(Field.MESSAGE.getPreferredName(), email, params)
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,6 +268,6 @@ public class EmailAction implements Action {
|
||||||
ParseField ATTACH_DATA = new ParseField("attach_data");
|
ParseField ATTACH_DATA = new ParseField("attach_data");
|
||||||
|
|
||||||
// result fields
|
// result fields
|
||||||
ParseField EMAIL = new ParseField("email");
|
ParseField MESSAGE = new ParseField("message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,7 +236,7 @@
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"dynamic": true,
|
"dynamic": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"email": {
|
"message": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"dynamic": true,
|
"dynamic": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
@ -13,7 +13,6 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||||
import org.elasticsearch.watcher.actions.email.service.EmailTemplate;
|
import org.elasticsearch.watcher.actions.email.service.EmailTemplate;
|
||||||
import org.elasticsearch.watcher.actions.email.service.support.EmailServer;
|
import org.elasticsearch.watcher.actions.email.service.support.EmailServer;
|
||||||
import org.elasticsearch.watcher.execution.ExecutionState;
|
import org.elasticsearch.watcher.execution.ExecutionState;
|
||||||
import org.elasticsearch.watcher.history.HistoryStore;
|
|
||||||
import org.elasticsearch.watcher.test.AbstractWatcherIntegrationTests;
|
import org.elasticsearch.watcher.test.AbstractWatcherIntegrationTests;
|
||||||
import org.elasticsearch.watcher.transport.actions.put.PutWatchResponse;
|
import org.elasticsearch.watcher.transport.actions.put.PutWatchResponse;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -101,11 +100,11 @@ public class HistoryTemplateEmailMappingsTests extends AbstractWatcherIntegratio
|
||||||
assertWatchWithMinimumActionsCount("_id", ExecutionState.EXECUTED, 1);
|
assertWatchWithMinimumActionsCount("_id", ExecutionState.EXECUTED, 1);
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch(HistoryStore.INDEX_PREFIX + "*").setSource(searchSource()
|
SearchResponse response = client().prepareSearch(HistoryStore.INDEX_PREFIX + "*").setSource(searchSource()
|
||||||
.aggregation(terms("from").field("result.actions.email.email.from"))
|
.aggregation(terms("from").field("result.actions.email.message.from"))
|
||||||
.aggregation(terms("to").field("result.actions.email.email.to"))
|
.aggregation(terms("to").field("result.actions.email.message.to"))
|
||||||
.aggregation(terms("cc").field("result.actions.email.email.cc"))
|
.aggregation(terms("cc").field("result.actions.email.message.cc"))
|
||||||
.aggregation(terms("bcc").field("result.actions.email.email.bcc"))
|
.aggregation(terms("bcc").field("result.actions.email.message.bcc"))
|
||||||
.aggregation(terms("reply_to").field("result.actions.email.email.reply_to"))
|
.aggregation(terms("reply_to").field("result.actions.email.message.reply_to"))
|
||||||
.buildAsBytes())
|
.buildAsBytes())
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue