By ··9 min read

Why a SitecoreAI publish takes 15 minutes to reach Sitecore Search

A SitecoreAI publish reaches Sitecore Search in about 15 minutes, and a 200 from the Ingestion API means the document is only queued. Here is every hop, timed, and how to check progress instead of waiting.

You publish an article in SitecoreAI. The page is live within seconds. You search for its title and get nothing, so you check the logs, see that your code called the Search Ingestion API, and see a 200 OK. It looks like everything worked, and the item is still missing.

HTTP/1.1 200 OK
{"enqueued": true, "incremental_update_id": "{incrementalUpdateId}"}

Nothing is broken. The word to read in that response is enqueued.

How the pipeline works

Five systems sit between an author and a search result. Each hands the work to the next and returns before the next one has finished.

  • SitecoreAI (the product formerly called XM Cloud) is where authors edit. Clicking Publish copies the item to Experience Edge.
  • Experience Edge is Sitecore’s hosted delivery store. Your website reads published content from it over GraphQL. It can also call a webhook, which is a URL Edge sends an HTTP request to when something is published.
  • A Next.js route on Vercel is the website’s own code. In this project it receives the webhook, reads the published item back from Edge, builds a search document from it and sends it on.
  • Sitecore Search is a hosted search product. Its Ingestion API accepts documents. It does not write them to the index straight away: each call goes into a queue and gets an incremental_update_id. Every document belongs to a source, a named collection you set up in Search (one per content type, say), and an entity, the document type (content in this project). Both appear in the API’s URLs, next to the domain ID that identifies your Search account.
  • The serving index is the copy of the data that search queries read. It is refreshed from the ingested data separately, so a document can be fully ingested and still not be returned by a query.

Delays stack because each hop is asynchronous. The caller gets an answer as soon as its work is accepted, not when the whole chain is done. That keeps every system fast and independent, and it also means no single response can tell you when the content is searchable.

Five rows from SitecoreAI authoring down to the Search serving index, each with the time it adds: 18 seconds, 72 seconds, about 1.5 seconds, about 4.5 minutes and about 10 minutes.
The five hops and the time each one adds. The last one is the one authors notice.

What I measured

I first tried the obvious thing: publish, then query Search every couple of minutes until the document appeared. It worked, but it told me nothing about where the time went, and a stuck document looked the same as a slow one. Checking the queue instead of the search results is what turned this from a guess into a measurement.

The timings from a full run on a development environment, counted from the Publish click:

Hop Time
Item resolvable on Experience Edge about 18 s
Edge calls the Vercel webhook about 90 s
Webhook to documents searchable about 13 min (791 s)
Publish to searchable, total about 14.7 min

That run could not see inside the last hop, and the route’s own logs did not stream back from Vercel. Run locally on one document, the route took about 1.5 seconds from webhook to queued, so almost all of those 13 minutes belong to Search.

A second run, on a test environment that sends to the same Search domain, split the last hop in two. This time a script called our route as soon as Edge had the item, so there was no webhook wait:

Milestone Time since Publish
Edge ready 18 s
Ingestion queue reports finished for the three people 289 s (4.8 min)
A query for the people attached to the article returns all three 914 s (15.2 min)
A query for the article itself returns it 951 s (15.8 min)

So ingestion finishing is not the end. The queue was done after about five minutes, and the document still took about ten more minutes to show up in query results. That second delay is the serving refresh. The Customer Engagement Console (CEC), the Search admin screen, showed “indexing complete” at the same point my script saw the documents appear.

Three horizontal bars on a 0 to 16 minute axis for the second run: publish to Edge 18 seconds, queue about 4.5 minutes, serving refresh about 10.5 minutes, searchable at 15.2 and 15.8 minutes.
The second run on one clock. The two Search stages are most of the wait.

The two runs measured different things: the first used the real webhook, the second had a script call our route. That is why the second run has no webhook stage. The two Search stages took about 13 minutes in the first run and about 15 in the second, and they move around a lot, which is the next surprise.

The queue time is not a constant

The queue stage is the one that varies. Across the sessions I ran, the same kind of update took very different times to move from enqueued to finished.

What I pushed Queue time
5 documents, sent one by one about 30 s
1 people document 4.2 min
3 people documents about 4.5 min
5 people documents 11 min
5 people documents, an earlier try 22 min (enqueued for about 20, running for under 2)
75 updates in one burst enqueued for about 4 min, then all finished within a minute

I can’t tell you why some runs were slower. Every one of them went to the same Search domain. What I can say is that the numbers differ by about forty times, so any fixed sleep you put in a test will be wrong sometimes. Poll the status instead.

One more case is worth knowing about. Once, a document reached finished and still never appeared in queries. The cause was in the document I had built, not in the pipeline, and it is a separate story. finished tells you the queue processed the update, and a query is still the only proof that a search will find it.

How to check progress instead of waiting

Every push returns an incremental_update_id. The status endpoint takes that ID and says where the update is. Three steps give you the whole timeline.

  1. Keep the ID. The first sample logs it when the document is sent. Without it you can only watch the search results.
  2. Poll the status endpoint until it says finished or failed. I saw enqueued, running and finished; Sitecore’s documentation adds failed, which means the document was not changed and the request should be sent again.
  3. Then query Search for the document, because the serving refresh is still ahead.

The route that receives the webhook should answer quickly and keep working after the response. The Vercel helper waitUntil does that: the function replies 200 and the indexing carries on inside the same invocation, up to the function’s maximum duration. Edge’s webhook body carries the published items in an updates array.

src/pages/api/editing/createupdateindex.ts
import type { NextApiRequest, NextApiResponse } from 'next';
import { waitUntil } from '@vercel/functions';
// Resolves each updated item to a document and calls pushDocument (below).
import { indexItems } from '@/lib/search-ingestion';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const updates = req.body?.updates ?? [];
// Reply first; the indexing carries on after the response.
waitUntil(indexItems(updates));
res.status(200).json({ accepted: updates.length });
}

Where the document is sent to Search, log the response. The incremental_update_id is in it, and the URL shape is the one the team’s code used. A PUT replaces the whole document, and creates it if it does not exist yet. The base URL can differ by region, so copy yours from the Search developer settings.

src/lib/search-ingestion.ts
const BASE = 'https://discover.sitecorecloud.io/ingestion/v1/domains/{domainId}';
export async function pushDocument(sourceId: string, documentId: string, fields: Record<string, unknown>) {
const url = `${BASE}/sources/${sourceId}/entities/content/documents/${documentId}?locale=en_us`;
const response = await fetch(url, {
method: 'PUT',
headers: { Authorization: process.env.SEARCH_INGESTION_TOKEN!, 'Content-Type': 'application/json' },
body: JSON.stringify({ document: { id: documentId, fields } }),
});
const result = await response.json();
// { enqueued: true, incremental_update_id: '...' }
console.log('ingestion', documentId, result);
return result.incremental_update_id as string;
}

Now the check. The Authorization header carries the ingestion token as it is, with no Bearer prefix. The same ingestion token works for the status call.

scripts/wait-for-ingestion.ts
const BASE = 'https://discover.sitecorecloud.io/ingestion/v1/domains/{domainId}';
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
export async function waitForFinished(sourceId: string, updateId: string) {
const url = `${BASE}/sources/${sourceId}/entities/content/status/${updateId}`;
const started = Date.now();
for (;;) {
const response = await fetch(url, {
headers: { Authorization: process.env.SEARCH_INGESTION_TOKEN!, 'Content-Type': 'application/json' },
});
const { status } = await response.json();
const seconds = Math.round((Date.now() - started) / 1000);
console.log(`t+${seconds}s`, status ?? 'unknown');
if (status === 'finished') return seconds;
if (status === 'failed') throw new Error(`update ${updateId} failed after ${seconds}s`);
await sleep(15_000);
}
}

The endpoint answers with one field, such as {"status":"enqueued"}. An empty {} came back in two cases: for an ID I asked about under the wrong source, and for the first few seconds after a push to the right one. So treat {} as “not known yet”, keep polling, and pass the source the document was sent to.

To measure the whole chain the way I did, wrap the same loop in timers. Note the time of the Publish click, poll Edge for the item until it resolves, send the document, run the status loop above and finish with a Search query for the document. The helpers named here are mine; this is a trimmed version of the script, not the whole thing:

scripts/time-publish.ts
const t0 = Date.now();
await publishItem(articleId); // Authoring GraphQL publish mutation
await until(() => edgeHasItem(articleId)); // without language the query never resolves: item(path: "...", language: "en") { id }
console.log('edge ready', secondsSince(t0));
const updateId = await pushDocument(sourceId, articleId, await buildFields(articleId));
await waitForFinished(sourceId, updateId);
console.log('queue finished', secondsSince(t0));
await until(() => searchFindsId(articleId)); // Search query API, filtered on the document id
console.log('searchable', secondsSince(t0));

How to check it worked

Watch the status and the search together for one real publish, then compare with the timings above.

  1. Publish a test article and note the time.
  2. When your route logs the incremental_update_id, start waitForFinished for it.
  3. After finished, query Search for the document every minute or two. With these tools, expect to see it somewhere around ten minutes later.
  4. If the status stays enqueued far beyond the 22 minutes I saw, treat it as a real problem and look at the Search side.

If the page itself still returns a 404 after a publish, that is a different cache: see why a cached notFound survives a publish in Next.js. I also built a search on another stack and measured what improved its answers: keyword plus vector search, RRF and a reranker.

Takeaways

  • A 200 from the Ingestion API means enqueued, not indexed.
  • Keep incremental_update_id from every push and poll the status endpoint with it.
  • finished is not searchable. Budget about ten more minutes for the serving refresh, then verify with a real query.
  • Queue time ranged from 30 seconds to 22 minutes for similar updates, so never write a fixed wait into a test.
  • Count from the Publish click. In my runs, Edge took 18 seconds and the webhook arrived at about 90, which is small next to the Search stages.
  • Tell authors up front that search takes about a quarter of an hour. It saves the “did it work?” message.