Local services can be available before a corresponding indexer is active. As a result, these local services can save content in the database and yet not index the content into Elasticsearch (or Solr). It happens a bunch of times with portal instance lifecycle listeners, which often are running in a state where the service is available, but not the indexer.
If you are having problems because your code uses a local service before an indexer is available, and your code is in a DS, you can add a reference to the indexer, so the DS will only be available when both the service and the indexer are available.
We have an integration test that reproduces this behavior in https://github.com/vagnerbc/liferay-portal/blob/13d8a7bb3f386141069badcf5792b7463c7f5d0e/modules/apps/company/company-test/src/testIntegration/java/com/liferay/company/search/test/DefaultDDLStructuresPortalInstanceTest.java#L183