Skip to content

Commit

Permalink
fix: remove the _score field (#197197) (#198101)
Browse files Browse the repository at this point in the history
Signed-off-by: fangshun <[email protected]>
Co-authored-by: Davis McPhee <[email protected]>
  • Loading branch information
fangshun-z and davismcphee authored Nov 1, 2024
1 parent 7f59da2 commit b0214f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,7 @@ describe('Source Viewer component', () => {
);
const jsonCodeEditor = comp.find(JsonCodeEditorCommon);
expect(jsonCodeEditor).not.toBe(null);
expect(jsonCodeEditor.props().jsonValue).toContain('_source');
expect(jsonCodeEditor.props().jsonValue).not.toContain('_score');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type { DataView } from '@kbn/data-views-plugin/public';
import type { DataTableRecord } from '@kbn/discover-utils/types';
import { ElasticRequestState } from '@kbn/unified-doc-viewer';
import { isLegacyTableEnabled, SEARCH_FIELDS_FROM_SOURCE } from '@kbn/discover-utils';
import { omit } from 'lodash';
import { getUnifiedDocViewerServices } from '../../plugin';
import { useEsDocSearch } from '../../hooks';
import { getHeight, DEFAULT_MARGIN_BOTTOM } from './get_height';
Expand Down Expand Up @@ -70,7 +71,7 @@ export const DocViewerSource = ({

useEffect(() => {
if (requestState === ElasticRequestState.Found && hit) {
setJsonValue(JSON.stringify(hit.raw, undefined, 2));
setJsonValue(JSON.stringify(omit(hit.raw, '_score'), undefined, 2));
}
}, [requestState, hit]);

Expand Down

0 comments on commit b0214f3

Please sign in to comment.