Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit d5486be

Browse files
author
Tomasz Kostuch
authored
Merge pull request #474 from gibkigonzo/feature/387
Add `request_cache` to ES url for version 6+
2 parents 5fe992e + fd51b9a commit d5486be

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [1.12.1] - UNRELEASED
99

10+
### Added
11+
12+
- Add request_cache to ES url - @gibkigonzo (#387)
13+
1014
### Fixed
1115

12-
- AAdd error status code as number in `apiError` - @gibkigonzo (#442)
16+
- Add error status code as number in `apiError` - @gibkigonzo (#442)
1317
- Get proper tax calculation for multistore - @didkan (#464)
1418
- Create only one ES client instance per app - @gibkigonzo (#393)
1519

config/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"review"
4141
],
4242
"apiVersion": "5.6",
43-
43+
"cacheRequest": false,
4444
"searchScoring": {
4545
"attributes": {
4646
"attribute_code": {

src/lib/elastic.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ function adjustBackendProxyUrl (req, indexName, entityType, config) {
4949
delete parsedQuery.request
5050
delete parsedQuery.request_format
5151
delete parsedQuery.response_format
52+
if (config.elasticsearch.cacheRequest) {
53+
parsedQuery.request_cache = !!config.elasticsearch.cacheRequest
54+
}
55+
5256
url = config.elasticsearch.host + ':' + config.elasticsearch.port + '/' + adjustIndexName(indexName, entityType, config) + '/_search?' + queryString.stringify(parsedQuery)
5357
}
5458
if (!url.startsWith('http')) {

0 commit comments

Comments
 (0)