How to update indices for dynamic mesh in OpenGL?

So I am making a 3D batchrenderer for my engine, and the basic concept is that we make large enough VBO and IBO to accompany all the vertex data(positions, normals, uv etc.) and update the VBO using glMapBuffer or using glbuffersubdata everyframe if we want to make any changes, but in this case the pattern of the IBO (Index Buffer) is predefined (i.e. we assume we have quads and fill it with 012230 for the entirety of the IBO size) but when using 3D models this won’t be the case the IBOs data would be different, so how do I change the IBO data if I instantiate a new model or suppose if I am generating a UV sphere and want to change it’s subdivisions? I have no idea how to deal with dynamically changing(need not be frequent) indices data when using VAOs, VBOs and Index Buffers. afaik we cannot map the ELEMENT_ARRAY_BUFFER, and glDrawElements does accept a pointer to indices data but only when we are not using VAOs and VBOs, if we are using them it takes the last argument as a pointer offset in the currently bound ELEMENT_ARRAY_BUFFER. So what’s the best way to deal with dynamic indices?