opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.65k stars 857 forks source link

[BUG][Discover] Unable to sort Date scripted fields #5127

Open ananzh opened 11 months ago

ananzh commented 11 months ago

This is a legacy issue and not caused by Discover 2.0. This functional test is skipped due to this bug:

//add a test to sort date scripted field
      //https://github.com/elastic/kibana/issues/75711
      // TODO: replace updateExpectedResultHere with actual data value once bug is fixed
      it.skip('should sort scripted field value in Discover', async function () {
        await testSubjects.click(`dataGridHeaderCell-${scriptedPainlessFieldName2}`);
        await PageObjects.discover.clickTableHeaderListItem(scriptedPainlessFieldName2, 'Sort A-Z');
        await PageObjects.header.waitUntilLoadingHasFinished();
        await testSubjects.click('dataGridHeaderCell-@timestamp');
        await PageObjects.discover.clickTableHeaderListItem('@timestamp', 'Sort A-Z');
        await PageObjects.header.waitUntilLoadingHasFinished();
        const sortedDataByTimeField = await PageObjects.discover.getDataGridTableValues();
        expect(sortedDataByTimeField[0][0]).contain('updateExpectedResultHere');
        expect(sortedDataByTimeField[0][1]).contain('2015-09-18 07:00');

        await testSubjects.click('dataGridColumnSortingButton');
        await PageObjects.discover.removeSort(`${scriptedPainlessFieldName2}`);
        await PageObjects.header.waitUntilLoadingHasFinished();
        const sortedDataByPainlessField = await PageObjects.discover.getDataGridTableValues();
        expect(sortedDataByPainlessField[0][0]).contain('updateExpectedResultHere');
        expect(sortedDataByPainlessField[0][1]).contain('2015-09-18 07:00');
      });
vvavdiya commented 11 months ago

I'd like to take a look at this. @ananzh can you please help with more context/details of the issue.

vvavdiya commented 11 months ago

@ananzh can you please help with more context/details of the issue and how to reproduce it?