Uploaded image for project: 'Atlassian Intelligence'
  1. Atlassian Intelligence
  2. AI-440

Confluence Search API doesn't work well limiting results

    • Severity 3 - Minor

      Issue Summary

      The Confluence serch endpoint /wiki/rest/api/search?cql= doesn't work well in case we add a limitation in the search - the top results will be 250.

      Steps to Reproduce

      1. Create around 1000 of pages on a space (you can use the below script)
        #!/bin/bash
        UIDPAS='EMAIL_ADDRESS:API_TOKEN'
        space='SPACEKEY'
        site='https://SITENAME.atlassian.net/wiki' 
        totalpage=1000
        
        for ((i=1;i<=$totalpage;i++)); 
        do 
           echo $i
          curl -u $UIDPAS -X POST -H 'Content-Type: application/json' -d '{"type":"page","title":"Test API page '$i'","space":{"key":"'$space'"},"body":{"storage":{"value":"<p>This is a page created from an API call, later this page will be queried out via the TEST API.</p>","representation":"storage"}}}' $site/rest/api/content
        done
      2. Once all the pages are created, run this endpoint on the browser: https://SITENAME.atlassian.net/wiki/rest/api/search?cql=title~page?&limit=1000&start=0

      Expected Results

      With no pagination, it should return all the 1000 pages we just created (as well as other pages with "page" on their title.

      Actual Results

      It only shows 250 results, even the totalSize field showing the total amount of results.

      Notes

      • Let's say you then try to get &limit=1000&start=250, it still won't show the expected number of results in the page.

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

            [AI-440] Confluence Search API doesn't work well limiting results

            pqz made changes -
            Component/s Original: Search - Scaling [ 61411 ]
            Component/s Original: Search - Core [ 46383 ]
            Component/s Original: Ecosystem - API Framework [ 46317 ]
            Component/s New: Search - Core [ 75296 ]
            Component/s New: Search - Core [ 75296 ]
            Component/s New: Admin Experience [ 74216 ]
            Key Original: CONFCLOUD-70561 New: AI-440
            QA Demo Status Original: Not Done [ 14330 ]
            QA Kickoff Status Original: Not Done [ 14234 ]
            Support reference count Original: 1
            Project Original: Confluence Cloud [ 18513 ] New: Atlassian Intelligence [ 23110 ]
            Sunny Xu (Inactive) made changes -
            Component/s New: Ecosystem - API Framework [ 46317 ]
            Component/s New: Search - Core [ 46383 ]
            David Rizzuto made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Short Term Backlog [ 12074 ] New: Closed [ 6 ]
            Sunny Xu (Inactive) made changes -
            Due Date New: 08/Sep/2020
            David Rizzuto made changes -
            Priority Original: Low [ 4 ] New: High [ 2 ]
            David Rizzuto made changes -
            Status Original: Needs Triage [ 10030 ] New: Short Term Backlog [ 12074 ]

            Hello. The reason you might be seeing some issues is because we have deprecated the start param in the API here: https://developer.atlassian.com/cloud/confluence/change-notice-moderize-search-rest-apis/ Please switch over the new method of pagination as mentioned in the notice. Also, you should see a max of 250 results with each request. Please do not rely on the max count because the API does not enforce a specific max number of results returned. This is subject to change even in the future.

            Swati Katta added a comment - Hello. The reason you might be seeing some issues is because we have deprecated the start param in the API here:  https://developer.atlassian.com/cloud/confluence/change-notice-moderize-search-rest-apis/  Please switch over the new method of pagination as mentioned in the notice. Also, you should see a max of 250 results with each request. Please do not rely on the max count because the API does not enforce a specific max number of results returned. This is subject to change even in the future.
            Peter Obara made changes -
            Component/s Original: Core - APIs [ 46317 ]

            Swati Katta added a comment - Here is the deprecation notice for using start param:  https://developer.atlassian.com/cloud/confluence/change-notice-moderize-search-rest-apis/
            Peter Obara made changes -
            Assignee New: David Rizzuto [ drizzuto ]

              drizzuto David Rizzuto
              vsiqueira Vinicius (Inactive)
              Affected customers:
              0 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: