-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Elasticsearch from 7.17 to 8 #7389
Conversation
7c80e28
to
4aa6ab1
Compare
@@ -0,0 +1,143 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from search
* https://github.com/elastic/elasticsearch-js/issues/1604 | ||
* @param total total number of documents | ||
*/ | ||
export const getSearchTotalCount = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only new construct for the moved file
@@ -21,7 +21,7 @@ | |||
"precommit": "lint-staged" | |||
}, | |||
"dependencies": { | |||
"@elastic/elasticsearch": "7.17.13", | |||
"@elastic/elasticsearch": "8.13.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elasticsearch.js does not need to follow the same minor as docker image. 8.14.x
had some issues with undici.
@@ -79,7 +80,7 @@ export const up = async (db: Db, client: MongoClient) => { | |||
} catch (error: any) { | |||
// eslint-disable-next-line no-console | |||
console.error( | |||
`Migration - ElasticSearch :: Process for populating missing eventLocationId/eventJurisdictionIds for ${elasticDoc.id} failed : ${error.stack}` | |||
`Migration - ElasticSearch :: Process for populating missing eventLocationId/eventJurisdictionIds for ${elasticDoc._id} failed: ${error.stack}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type error here. On the function below, _id
is used, too.
return await client.update( | ||
{ | ||
index: ELASTICSEARCH_INDEX_NAME, | ||
// type: 'compositions', @todo: check whether this should work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could someone confirm that these are not actually needed? type
was deprecated and is only used here
Related to breaking change.
https://github.com/elastic/elasticsearch/pull/53670/files#diff-f5af866d898d3af4dd418c4212ad2d3ebb89e941d8ad4052a7512bf416a7e2d5L84
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The types
property was removed from the elasticsearch/dbhelper.ts
file here: fc2594d#diff-f1ee21482bf25e832b890c7a5d40825103ec072bf33ec84275d4022b12adfd75L26
So it should safe to do so here as well
return await client.search<SearchDocument>( | ||
{ | ||
index: ELASTICSEARCH_INDEX_NAME, | ||
// type: 'compositions', @todo: check whether this should work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"allowJs": true, | ||
"moduleResolution": "node", | ||
"moduleResolution": "node16", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required for commons import
} from '@opencrvs/commons/types' | ||
import { findName } from '@search/features/fhir/fhir-utils' | ||
|
||
export const enum EVENT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved under commons/search
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would appreciate second pair of eyes especially here to ensure this stayed as it should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a single comment otherwise looked fine to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @makelicious! Really appreciate the small refactors here & there
@@ -252,6 +252,7 @@ services: | |||
- HEARTH_MONGO_URL=mongodb://mongo1/hearth-dev | |||
- DASHBOARD_MONGO_URL=mongodb://mongo1/performance | |||
- OPENHIM_MONGO_URL=mongodb://mongo1/openhim-dev | |||
- SEARCH_URL=http://search:9090/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might just be the reason why the reindexing wasn't working properly on our servers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to just remove this migration as we are running the elastic reindex on every deploy from here: https://github.com/opencrvs/opencrvs-core/blob/develop/packages/migration/run-migrations.sh#L42
return await client.update( | ||
{ | ||
index: ELASTICSEARCH_INDEX_NAME, | ||
// type: 'compositions', @todo: check whether this should work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The types
property was removed from the elasticsearch/dbhelper.ts
file here: fc2594d#diff-f1ee21482bf25e832b890c7a5d40825103ec072bf33ec84275d4022b12adfd75L26
So it should safe to do so here as well
bool: { | ||
must: { | ||
bool: { | ||
must: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool: { | |
must: { | |
bool: { | |
must: [ | |
bool: { | |
must: [ |
We probably don't the extra nesting right? It wasn't there previously too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we don't! Glad that you spotted it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a single comment otherwise looked fine to me!
e4edcd1
to
9747f22
Compare
ignore types in order to test the setup
elasticsearch 8 defaults to security.enabled. Fix tests to match new payload
forced production to use http
Results to Error: connect ECONNREFUSED ::1:9090 otherwise on QA and locally
compositions were removed already from db-helper earlier
9747f22
to
6645e83
Compare
🍒 Merge changes from PR #7389 to release-v1.6.0
In order to fix the issue #7149 we needed to upgrade to next major version of elasticsearch.
Changes:
{meta: true}
option to keep the payload compatible with 7.x.x formatNeeds config changes from: opencrvs/opencrvs-countryconfig#216