summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Elastic/Role
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-07-28 19:37:17 +0200
committerGitHub <noreply@github.com>2017-07-28 19:37:17 +0200
commitdc378846874cca43be0a187d7c38d787395a6538 (patch)
treedc63faa45c0bd64b3eb26986a09a15895fc8b42b /Bugzilla/Elastic/Role
parent078bff5ad35277f31e7db5fe1761e41e1c76d1de (diff)
downloadbugzilla-dc378846874cca43be0a187d7c38d787395a6538.tar.gz
bugzilla-dc378846874cca43be0a187d7c38d787395a6538.tar.xz
Bug 1383802 - Elasticsearch indexed documents lack an _id based on the object's primary key
Diffstat (limited to 'Bugzilla/Elastic/Role')
-rw-r--r--Bugzilla/Elastic/Role/Object.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/Bugzilla/Elastic/Role/Object.pm b/Bugzilla/Elastic/Role/Object.pm
index c51948ee9..674545d04 100644
--- a/Bugzilla/Elastic/Role/Object.pm
+++ b/Bugzilla/Elastic/Role/Object.pm
@@ -25,6 +25,11 @@ sub ES_SELECT_ALL_SQL {
requires qw(ES_SELECT_UPDATED_SQL);
+sub es_id {
+ my ($self) = @_;
+ return join('_', $self->ES_TYPE, $self->id);
+}
+
around 'ES_PROPERTIES' => sub {
my $orig = shift;
my $self = shift;
@@ -41,6 +46,7 @@ around 'es_document' => sub {
$doc->{es_mtime} = $mtime;
$doc->{$self->ID_FIELD} = $self->id;
+ $doc->{_id} = $self->es_id;
return $doc;
};