Skip to content

Commit 2842746

Browse files
committed
Add flow_id to index as well since we need to switch flows to use ids anyway
1 parent 04d8945 commit 2842746

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

contacts/index_settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
"flow": {
154154
"type": "keyword"
155155
},
156+
"flow_id": {
157+
"type": "integer"
158+
},
156159
"flow_history": {
157160
"type": "integer"
158161
},

contacts/query.go

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ SELECT org_id, id, modified_on, is_active, row_to_json(t) FROM (
6262
(
6363
SELECT f.uuid FROM flows_flow f WHERE f.id = contacts_contact.current_flow_id
6464
) AS flow,
65+
current_flow_id AS flow_id,
6566
(
6667
SELECT array_to_json(array_agg(DISTINCT fr.flow_id))
6768
FROM flows_flowrun fr WHERE fr.contact_id = contacts_contact.id

indexer_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ func TestIndexing(t *testing.T) {
104104
assertQuery(t, client, physicalName, elastic.NewMatchQuery("flow", "6d3cf1eb-546e-4fb8-a5ca-69187648fbf6"), []int64{2, 3})
105105
assertQuery(t, client, physicalName, elastic.NewMatchQuery("flow", "4eea8ff1-4fe2-4ce5-92a4-0870a499973a"), []int64{4})
106106

107+
assertQuery(t, client, physicalName, elastic.NewMatchQuery("flow_id", 1), []int64{2, 3})
108+
assertQuery(t, client, physicalName, elastic.NewMatchQuery("flow_id", 2), []int64{4})
109+
107110
assertQuery(t, client, physicalName, elastic.NewMatchQuery("flow_history", 1), []int64{1, 2})
108111
assertQuery(t, client, physicalName, elastic.NewMatchQuery("flow_history", 2), []int64{1})
109112

0 commit comments

Comments
 (0)