Microsoft Graph Search API response incorrect 'total' value

harryK9 1 Reputation point
2022-12-21T11:48:42.723+00:00

Hi all,
I am using Microsoft search API to search across the resources on SharePoint. The search API returns the 'total' in response as 0 but there are only 7 results present.
Any possible explanation for this incorrect data or any alternative approach?
Any help would be appreciated.

     API: https://graph.microsoft.com/v1.0/search/query  
     Method: POST  
     Body : {  
         "requests": [  
             {  
                 "entityTypes": [  
                     "driveItem"  
                 ],  
                 "query": {  
                     "queryString": "meal AND ContentType:Document"  
                 }  
             }  
         ]  
     }  

Response:
272902-image-2022-12-21-170534862.png

The search API returns the 'total' in response as 0 but there are 7 results present.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,573 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,610 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,666 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 31,071 Reputation points Microsoft Vendor
    2022-12-22T02:23:00.43+00:00

    Hi @harryK9
    Per my research, you can try to add "trimDuplicates": true to trim duplicate search results. Please refer to the following body

    {  
        "requests": [  
            {  
                "entityTypes": [  
                    "driveItem"  
                ],  
                "query": {  
                    "queryString": "meal AND ContentType:Document"  
                },  
                "trimDuplicates": true  
            }  
        ]  
    }  
    

    Here is the document for reference
    https://learn.microsoft.com/en-us/graph/search-concept-trim-duplicate


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



  2. Bhanu Kiran 3,526 Reputation points
    2022-12-24T00:58:49.107+00:00

    Hi @harryK9 ,

    Thanks for reaching out.

    Please use different types of entityTypes as per the documentation and check if you are getting the same issue.

    If you are still facing the issue I would recommend you to raise a support case with Microsoft Graph, a Support Engineer will be able to assist you better. You can raise support ticket from
    http://aad.portal.azure.com/ or https://admin.microsoft.com/#/support/requests.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments