Skip to content

Commit

Permalink
fix: add opensearch support
Browse files Browse the repository at this point in the history
fix: remove ? at the end of _msearch
fix: improve default sort by id with unmapped_type addition
  • Loading branch information
siddharthlatest committed Sep 8, 2021
1 parent 2bf0c70 commit 7b8ee48
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/browser/src/apis/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ export default async (rawUrl, indexName) => {
res[defaultIndex].settings.index.version.upgraded ||
res[defaultIndex].settings.index.version.created;
} else {
version = '5';
version = '7';
}
} else {
version = res.version.number;
}

// Handle opensearch version
if (!version || Number(version[0]) < 5) {
version = '7';
}

return version.replace(/\./g, '');
} catch (error) {
throw new CustomError(
Expand Down
5 changes: 4 additions & 1 deletion packages/browser/src/components/DataBrowser/DataBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ class DataBrowser extends Component<Props> {
};

transformRequest = request => {
const newRequest = { ...request };
const newRequest = {
...request,
url: request.url.replace('_msearch?', '_msearch'),
};
if (newRequest.headers) {
Object.keys(newRequest.headers).forEach(headerItem => {
newRequest.headers[headerItem] = decodeURIComponent(
Expand Down
1 change: 1 addition & 0 deletions packages/browser/src/components/DataBrowser/ResultSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class ResultSet extends React.Component<Props, State> {
[sortField]: { order: sortOrder },
[version > 5 ? '_id' : '_uid']: {
order: sortOrder,
unmapped_type: 'long',
},
},
],
Expand Down

0 comments on commit 7b8ee48

Please sign in to comment.