Having an empty hits and response from elasticsearch when trying to query them via an api

hello , now I am facing this issue here , and i would like to take an idea from you ,
here is my service file for the api

//trying to populate the server here 

const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::energy.energy', async ({ strapi }) => {
  const { connector, testConn } = require('../../../../helpers/client_elastic.js');
  const client = connector();

  testConn(client);
  console.log('Connection to Elasticsearch successful');

  const searchParams = {
    index: 'index', // Replace with the appropriate index name
    body: {
      query: {
        match_all: {} // Retrieve all documents
      }
    }
  };

  try {
    console.log('Sending search request to Elasticsearch');
    const response = await client.search(searchParams);

    console.log('Elasticsearch response:', response);

    const body = response.body || {};
    console.log('Received response from Elasticsearch:', response);

    const hits = response.hits?.hits || [];
    console.log('Total hits:', hits.length);

    const mappedData = hits.map((hit) => {
      const source = hit._source;
      return {
        name: source.name,
        measuringPoint: source.measuringPoint,
        current: source.current,
        voltage: source.voltage,
        activePower: source.activePower,
        cosphi: source.cosphi,
        powerFactory: source.powerFactory,
        date: source.createAt,
      };
    });
    console.log("  ############### this is mappedData", mappedData)
    const results = mappedData.map((data) => {
      console.log(data);
      return data;
    });
    console.log("#############this is results",results)
    console.log('Transformed data:');
    results.forEach((data) => {
      console.log(data);
    });

    console.log(" ##############this is the results array ", results);

    return {
      results
    };
  } catch (error) {
    console.error('Error retrieving energy consumption data:', error);
    throw error;
  }
});

the problem is that , i am able to access the data in the console log , herre is the detailed log of the server

Welcome back!
To manage your project 🚀, go to the administration panel at:
http://localhost:1337/admin

To access the server ⚡️, go to:
http://localhost:1337

Energy consumption action called
Connection to Elasticsearch successful
Sending search request to Elasticsearch
Retrieved energy consumption data: {
 results: [],
 pagination: { page: 1, pageSize: 25, pageCount: 0, total: 0 }
}
this is before the sending of the data
this is after the sending of the data 
[2023-05-18 22:53:29.256] http: GET /api/energy-consumption (82 ms) 200
{
 name: 'elasticsearch',
 cluster_name: 'docker-cluster',
 cluster_uuid: 'YhJENNwuRoCCtDdiz5-4kQ',
 version: {
   number: '8.6.2',
   build_flavor: 'default',
   build_type: 'docker',
   build_hash: '2d58d0f136141f03239816a4e360a8d17b6d8f29',
   build_date: '2023-02-13T09:35:20.314882762Z',
   build_snapshot: false,
   lucene_version: '9.4.2',
   minimum_wire_compatibility_version: '7.17.0',
   minimum_index_compatibility_version: '7.0.0'
 },
 tagline: 'You Know, for Search'
}
Elasticsearch response: {
 took: 1,
 timed_out: false,
 _shards: { total: 1, successful: 1, skipped: 0, failed: 0 },
 hits: {
   total: { value: 9, relation: 'eq' },
   max_score: 1,
   hits: [
     [Object], [Object],
     [Object], [Object],
     [Object], [Object],
     [Object], [Object],
     [Object]
   ]
 }
}
Received response from Elasticsearch: {
 took: 1,
 timed_out: false,
 _shards: { total: 1, successful: 1, skipped: 0, failed: 0 },
 hits: {
   total: { value: 9, relation: 'eq' },
   max_score: 1,
   hits: [
     [Object], [Object],
     [Object], [Object],
     [Object], [Object],
     [Object], [Object],
     [Object]
   ]
 }
}
Total hits: 9
 ############### this is mappedData [
 {
   name: 'phase2',
   measuringPoint: 'MY_SENSOR0',
   current: 26.112,
   voltage: 234.449,
   activePower: 22517.918,
   cosphi: 0.895,
   powerFactory: 52.639,
   date: '2023-05-10T15:48:00.542Z'
 },
 {
   name: 'phase2',
   measuringPoint: 'MY_SENSOR1',
   current: 91.742,
   voltage: 226.565,
   activePower: 20896.89,
   cosphi: 1.632,
   powerFactory: 48.576,
   date: '2023-05-10T15:48:00.566Z'
 },
 {
   name: 'phase3',
   measuringPoint: 'MY_SENSOR2',
   current: 115.652,
   voltage: 239.214,
   activePower: 27142.946,
   cosphi: 0.737,
   powerFactory: 49.227,
   date: '2023-05-10T15:48:00.569Z'
 },
 {
   name: 'phase1',
   measuringPoint: 'MY_SENSOR0',
   current: 45.439,
   voltage: 243.47,
   activePower: 17125.657,
   cosphi: 0.6,
   powerFactory: 51.718,
   date: '2023-05-10T15:48:00.542Z'
 },
 {
   name: 'phase2',
   measuringPoint: 'MY_SENSOR2',
   current: 96.779,
   voltage: 232.078,
   activePower: 18535.919,
   cosphi: 1.585,
   powerFactory: 48.039,
   date: '2023-05-10T15:48:00.569Z'
 },
 {
   name: 'phase1',
   measuringPoint: 'MY_SENSOR2',
   current: 75.899,
   voltage: 222.088,
   activePower: 910.571,
   cosphi: 0.55,
   powerFactory: 52.837,
   date: '2023-05-10T15:48:00.569Z'
 },
 {
   name: 'phase3',
   measuringPoint: 'MY_SENSOR1',
   current: 27.94,
   voltage: 235.424,
   activePower: 26032.483,
   cosphi: 0.78,
   powerFactory: 48.433,
   date: '2023-05-10T15:48:00.566Z'
 },
 {
   name: 'phase3',
   measuringPoint: 'MY_SENSOR0',
   current: 116.696,
   voltage: 225.73,
   activePower: 26858.449,
   cosphi: 1.103,
   powerFactory: 49.435,
   date: '2023-05-10T15:48:00.542Z'
 },
 {
   name: 'phase1',
   measuringPoint: 'MY_SENSOR1',
   current: 102.288,
   voltage: 223.414,
   activePower: 24469.064,
   cosphi: 0.239,
   powerFactory: 48.159,
   date: '2023-05-10T15:48:00.566Z'
 }
]
{
 name: 'phase2',
 measuringPoint: 'MY_SENSOR0',
 current: 26.112,
 voltage: 234.449,
 activePower: 22517.918,
 cosphi: 0.895,
 powerFactory: 52.639,
 date: '2023-05-10T15:48:00.542Z'
}
{
 name: 'phase2',
 measuringPoint: 'MY_SENSOR1',
 current: 91.742,
 voltage: 226.565,
 activePower: 20896.89,
 cosphi: 1.632,
 powerFactory: 48.576,
 date: '2023-05-10T15:48:00.566Z'
}
{
 name: 'phase3',
 measuringPoint: 'MY_SENSOR2',
 current: 115.652,
 voltage: 239.214,
 activePower: 27142.946,
 cosphi: 0.737,
 powerFactory: 49.227,
 date: '2023-05-10T15:48:00.569Z'
}
{
 name: 'phase1',
 measuringPoint: 'MY_SENSOR0',
 current: 45.439,
 voltage: 243.47,
 activePower: 17125.657,
 cosphi: 0.6,
 powerFactory: 51.718,
 date: '2023-05-10T15:48:00.542Z'
}
{
 name: 'phase2',
 measuringPoint: 'MY_SENSOR2',
 current: 96.779,
 voltage: 232.078,
 activePower: 18535.919,
 cosphi: 1.585,
 powerFactory: 48.039,
 date: '2023-05-10T15:48:00.569Z'
}
{
 name: 'phase1',
 measuringPoint: 'MY_SENSOR2',
 current: 75.899,
 voltage: 222.088,
 activePower: 910.571,
 cosphi: 0.55,
 powerFactory: 52.837,
 date: '2023-05-10T15:48:00.569Z'
}
{
 name: 'phase3',
 measuringPoint: 'MY_SENSOR1',
 current: 27.94,
 voltage: 235.424,
 activePower: 26032.483,
 cosphi: 0.78,
 powerFactory: 48.433,
 date: '2023-05-10T15:48:00.566Z'
}
{
 name: 'phase3',
 measuringPoint: 'MY_SENSOR0',
 current: 116.696,
 voltage: 225.73,
 activePower: 26858.449,
 cosphi: 1.103,
 powerFactory: 49.435,
 date: '2023-05-10T15:48:00.542Z'
}
{
 name: 'phase1',
 measuringPoint: 'MY_SENSOR1',
 current: 102.288,
 voltage: 223.414,
 activePower: 24469.064,
 cosphi: 0.239,
 powerFactory: 48.159,
 date: '2023-05-10T15:48:00.566Z'
}
#############this is results [
 {
   name: 'phase2',
   measuringPoint: 'MY_SENSOR0',
   current: 26.112,
   voltage: 234.449,
   activePower: 22517.918,
   cosphi: 0.895,
   powerFactory: 52.639,
   date: '2023-05-10T15:48:00.542Z'
 },
 {
   name: 'phase2',
   measuringPoint: 'MY_SENSOR1',
   current: 91.742,
   voltage: 226.565,
   activePower: 20896.89,
   cosphi: 1.632,
   powerFactory: 48.576,
   date: '2023-05-10T15:48:00.566Z'
 },
 {
   name: 'phase3',
   measuringPoint: 'MY_SENSOR2',
   current: 115.652,
   voltage: 239.214,
   activePower: 27142.946,
   cosphi: 0.737,
   powerFactory: 49.227,
   date: '2023-05-10T15:48:00.569Z'
 },
 {
   name: 'phase1',
   measuringPoint: 'MY_SENSOR0',
   current: 45.439,
   voltage: 243.47,
   activePower: 17125.657,
   cosphi: 0.6,
   powerFactory: 51.718,
   date: '2023-05-10T15:48:00.542Z'
 },
 {
   name: 'phase2',
   measuringPoint: 'MY_SENSOR2',
   current: 96.779,
   voltage: 232.078,
   activePower: 18535.919,
   cosphi: 1.585,
   powerFactory: 48.039,
   date: '2023-05-10T15:48:00.569Z'
 },
 {
   name: 'phase1',
   measuringPoint: 'MY_SENSOR2',
   current: 75.899,
   voltage: 222.088,
   activePower: 910.571,
   cosphi: 0.55,
   powerFactory: 52.837,
   date: '2023-05-10T15:48:00.569Z'
 },
 {
   name: 'phase3',
   measuringPoint: 'MY_SENSOR1',
   current: 27.94,
   voltage: 235.424,
   activePower: 26032.483,
   cosphi: 0.78,
   powerFactory: 48.433,
   date: '2023-05-10T15:48:00.566Z'
 },
 {
   name: 'phase3',
   measuringPoint: 'MY_SENSOR0',
   current: 116.696,
   voltage: 225.73,
   activePower: 26858.449,
   cosphi: 1.103,
   powerFactory: 49.435,
   date: '2023-05-10T15:48:00.542Z'
 },
 {
   name: 'phase1',
   measuringPoint: 'MY_SENSOR1',
   current: 102.288,
   voltage: 223.414,
   activePower: 24469.064,
   cosphi: 0.239,
   powerFactory: 48.159,
   date: '2023-05-10T15:48:00.566Z'
 }
]
Transformed data:
{
 name: 'phase2',
 measuringPoint: 'MY_SENSOR0',
 current: 26.112,
 voltage: 234.449,
 activePower: 22517.918,
 cosphi: 0.895,
 powerFactory: 52.639,
 date: '2023-05-10T15:48:00.542Z'
}
{
 name: 'phase2',
 measuringPoint: 'MY_SENSOR1',
 current: 91.742,
 voltage: 226.565,
 activePower: 20896.89,
 cosphi: 1.632,
 powerFactory: 48.576,
 date: '2023-05-10T15:48:00.566Z'
}
{
 name: 'phase3',
 measuringPoint: 'MY_SENSOR2',
 current: 115.652,
 voltage: 239.214,
 activePower: 27142.946,
 cosphi: 0.737,
 powerFactory: 49.227,
 date: '2023-05-10T15:48:00.569Z'
}
{
 name: 'phase1',
 measuringPoint: 'MY_SENSOR0',
 current: 45.439,
 voltage: 243.47,
 activePower: 17125.657,
 cosphi: 0.6,
 powerFactory: 51.718,
 date: '2023-05-10T15:48:00.542Z'
}
{
 name: 'phase2',
 measuringPoint: 'MY_SENSOR2',
 current: 96.779,
 voltage: 232.078,
 activePower: 18535.919,
 cosphi: 1.585,
 powerFactory: 48.039,
 date: '2023-05-10T15:48:00.569Z'
}
{
 name: 'phase1',
 measuringPoint: 'MY_SENSOR2',
 current: 75.899,
 voltage: 222.088,
 activePower: 910.571,
 cosphi: 0.55,
 powerFactory: 52.837,
 date: '2023-05-10T15:48:00.569Z'
}
{
 name: 'phase3',
 measuringPoint: 'MY_SENSOR1',
 current: 27.94,
 voltage: 235.424,
 activePower: 26032.483,
 cosphi: 0.78,
 powerFactory: 48.433,
 date: '2023-05-10T15:48:00.566Z'
}
{
 name: 'phase3',
 measuringPoint: 'MY_SENSOR0',
 current: 116.696,
 voltage: 225.73,
 activePower: 26858.449,
 cosphi: 1.103,
 powerFactory: 49.435,
 date: '2023-05-10T15:48:00.542Z'
}
{
 name: 'phase1',
 measuringPoint: 'MY_SENSOR1',
 current: 102.288,
 voltage: 223.414,
 activePower: 24469.064,
 cosphi: 0.239,
 powerFactory: 48.159,
 date: '2023-05-10T15:48:00.566Z'
}
##############this is the results array  [
 {
   name: 'phase2',
   measuringPoint: 'MY_SENSOR0',
   current: 26.112,
   voltage: 234.449,
   activePower: 22517.918,
   cosphi: 0.895,
   powerFactory: 52.639,
   date: '2023-05-10T15:48:00.542Z'
 },
 {
   name: 'phase2',
   measuringPoint: 'MY_SENSOR1',
   current: 91.742,
   voltage: 226.565,
   activePower: 20896.89,
   cosphi: 1.632,
   powerFactory: 48.576,
   date: '2023-05-10T15:48:00.566Z'
 },
 {
   name: 'phase3',
   measuringPoint: 'MY_SENSOR2',
   current: 115.652,
   voltage: 239.214,
   activePower: 27142.946,
   cosphi: 0.737,
   powerFactory: 49.227,
   date: '2023-05-10T15:48:00.569Z'
 },
 {
   name: 'phase1',
   measuringPoint: 'MY_SENSOR0',
   current: 45.439,
   voltage: 243.47,
   activePower: 17125.657,
   cosphi: 0.6,
   powerFactory: 51.718,
   date: '2023-05-10T15:48:00.542Z'
 },
 {
   name: 'phase2',
   measuringPoint: 'MY_SENSOR2',
   current: 96.779,
   voltage: 232.078,
   activePower: 18535.919,
   cosphi: 1.585,
   powerFactory: 48.039,
   date: '2023-05-10T15:48:00.569Z'
 },
 {
   name: 'phase1',
   measuringPoint: 'MY_SENSOR2',
   current: 75.899,
   voltage: 222.088,
   activePower: 910.571,
   cosphi: 0.55,
   powerFactory: 52.837,
   date: '2023-05-10T15:48:00.569Z'
 },
 {
   name: 'phase3',
   measuringPoint: 'MY_SENSOR1',
   current: 27.94,
   voltage: 235.424,
   activePower: 26032.483,
   cosphi: 0.78,
   powerFactory: 48.433,
   date: '2023-05-10T15:48:00.566Z'
 },
 {
   name: 'phase3',
   measuringPoint: 'MY_SENSOR0',
   current: 116.696,
   voltage: 225.73,
   activePower: 26858.449,
   cosphi: 1.103,
   powerFactory: 49.435,
   date: '2023-05-10T15:48:00.542Z'
 },
 {
   name: 'phase1',
   measuringPoint: 'MY_SENSOR1',
   current: 102.288,
   voltage: 223.414,
   activePower: 24469.064,
   cosphi: 0.239,
   powerFactory: 48.159,
   date: '2023-05-10T15:48:00.566Z'
 }
]

but when i try to access is from the navigator , or via postman in a get request , here is the what i find

{
"results": [],
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 0,
"total": 0
}
}

do you have an idea why it is happening this way ? any suggested solution ?