@ocap/indexdb-elasticsearch 1.27.14 → 1.27.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/db.js +10 -6
- package/package.json +5 -5
package/lib/db.js
CHANGED
|
@@ -115,6 +115,7 @@ class ESIndexDB extends BaseIndexDB {
|
|
|
115
115
|
stakeFilter = {},
|
|
116
116
|
delegationFilter = {},
|
|
117
117
|
tokenFactoryFilter = {},
|
|
118
|
+
includeItxData = false,
|
|
118
119
|
} = {}) {
|
|
119
120
|
const pagination = formatPagination({ paging, defaultSortField: 'time' });
|
|
120
121
|
|
|
@@ -219,15 +220,18 @@ class ESIndexDB extends BaseIndexDB {
|
|
|
219
220
|
|
|
220
221
|
debug('listTransactions query conditions', conditions);
|
|
221
222
|
|
|
223
|
+
// Build query body
|
|
224
|
+
const queryBody = {
|
|
225
|
+
track_total_hits: TRACK_TOTAL_HITS,
|
|
226
|
+
query: conditions.length ? { bool: { must: conditions } } : FALLBACK_QUERY,
|
|
227
|
+
sort: [{ [pagination.order.field]: { order: pagination.order.type } }],
|
|
228
|
+
_source: { exclude: ['tx.itxJson.encoded_value'].concat(includeItxData ? [] : ['tx.itxJson.data']) },
|
|
229
|
+
};
|
|
230
|
+
|
|
222
231
|
const result = await this.tx.search({
|
|
223
232
|
from: pagination.cursor,
|
|
224
233
|
size: pagination.size,
|
|
225
|
-
body:
|
|
226
|
-
track_total_hits: TRACK_TOTAL_HITS,
|
|
227
|
-
query: conditions.length ? { bool: { must: conditions } } : FALLBACK_QUERY,
|
|
228
|
-
sort: [{ [pagination.order.field]: { order: pagination.order.type } }],
|
|
229
|
-
_source: { exclude: ['tx.itxJson.data', 'tx.itxJson.encoded_value'] }, // required to make api fast
|
|
230
|
-
},
|
|
234
|
+
body: queryBody,
|
|
231
235
|
});
|
|
232
236
|
|
|
233
237
|
const { items, paging: nextPaging } = formatQueryResult(result, pagination);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/indexdb-elasticsearch",
|
|
3
3
|
"description": "OCAP indexdb adapter that uses elasticsearch as backend",
|
|
4
|
-
"version": "1.27.
|
|
4
|
+
"version": "1.27.16",
|
|
5
5
|
"author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/ArcBlock/blockchain/issues",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"dotenv-flow": "^3.2.0",
|
|
18
18
|
"jest": "^29.7.0",
|
|
19
|
-
"@ocap/indexdb-test": "1.27.
|
|
19
|
+
"@ocap/indexdb-test": "1.27.16"
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/ArcBlock/blockchain/tree/master/indexdb/elasticsearch",
|
|
22
22
|
"keywords": [
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"bn.js": "^5.2.1",
|
|
41
41
|
"debug": "^4.3.6",
|
|
42
42
|
"lodash": "^4.17.21",
|
|
43
|
-
"@arcblock/did": "1.27.
|
|
44
|
-
"@ocap/indexdb": "1.27.
|
|
45
|
-
"@ocap/util": "1.27.
|
|
43
|
+
"@arcblock/did": "1.27.16",
|
|
44
|
+
"@ocap/indexdb": "1.27.16",
|
|
45
|
+
"@ocap/util": "1.27.16"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"lint": "eslint tests lib",
|