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:
Martijn van Groningen 2015-06-17 10:38:25 +02:00
parent 4c6d709bca
commit bcb7428868
5 changed files with 11 additions and 12 deletions

View File

@ -86,4 +86,4 @@
- match: { "watch_record.result.actions.0.id" : "email_admin" }
- match: { "watch_record.result.actions.0.status" : "simulated" }
- 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" }

View File

@ -71,4 +71,4 @@
- match: { "watch_record.result.condition.met": true }
- match: { "watch_record.result.actions.0.id" : "email_admin" }
- 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" }

View File

@ -192,7 +192,7 @@ public class EmailAction implements Action {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
return builder.startObject(type)
.field(Field.ACCOUNT.getPreferredName(), account)
.field(Field.EMAIL.getPreferredName(), email, params)
.field(Field.MESSAGE.getPreferredName(), email, params)
.endObject();
}
}
@ -213,7 +213,7 @@ public class EmailAction implements Action {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
return builder.startObject(type)
.field(Field.EMAIL.getPreferredName(), email, params)
.field(Field.MESSAGE.getPreferredName(), email, params)
.endObject();
}
}
@ -268,6 +268,6 @@ public class EmailAction implements Action {
ParseField ATTACH_DATA = new ParseField("attach_data");
// result fields
ParseField EMAIL = new ParseField("email");
ParseField MESSAGE = new ParseField("message");
}
}

View File

@ -236,7 +236,7 @@
"type": "object",
"dynamic": true,
"properties": {
"email": {
"message": {
"type": "object",
"dynamic": true,
"properties": {

View File

@ -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.support.EmailServer;
import org.elasticsearch.watcher.execution.ExecutionState;
import org.elasticsearch.watcher.history.HistoryStore;
import org.elasticsearch.watcher.test.AbstractWatcherIntegrationTests;
import org.elasticsearch.watcher.transport.actions.put.PutWatchResponse;
import org.junit.After;
@ -101,11 +100,11 @@ public class HistoryTemplateEmailMappingsTests extends AbstractWatcherIntegratio
assertWatchWithMinimumActionsCount("_id", ExecutionState.EXECUTED, 1);
SearchResponse response = client().prepareSearch(HistoryStore.INDEX_PREFIX + "*").setSource(searchSource()
.aggregation(terms("from").field("result.actions.email.email.from"))
.aggregation(terms("to").field("result.actions.email.email.to"))
.aggregation(terms("cc").field("result.actions.email.email.cc"))
.aggregation(terms("bcc").field("result.actions.email.email.bcc"))
.aggregation(terms("reply_to").field("result.actions.email.email.reply_to"))
.aggregation(terms("from").field("result.actions.email.message.from"))
.aggregation(terms("to").field("result.actions.email.message.to"))
.aggregation(terms("cc").field("result.actions.email.message.cc"))
.aggregation(terms("bcc").field("result.actions.email.message.bcc"))
.aggregation(terms("reply_to").field("result.actions.email.message.reply_to"))
.buildAsBytes())
.get();