Use this file to discover all available pages before exploring further.
opensearch-wiki-indexer is the module that consumes Wikipedia change events from Kafka and indexes them into OpenSearch. Running on a fixed 5-second schedule, it polls the recent_change_stream topic and writes each Change document to the wiki-changes OpenSearch index using the page title as the document ID.
Package:WikiIndexerThe application entry point for the indexer module. Bootstraps the Spring context, enables scheduled task execution, and scans the Wikicommon package for shared model beans.
WikiIndexerStreamApplication.java
package WikiIndexer;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.context.annotation.ComponentScan;import org.springframework.scheduling.annotation.EnableScheduling;@SpringBootApplication@EnableScheduling@ComponentScan({"Wikicommon"})public class WikiIndexerStreamApplication { public static void main(String[] args) { SpringApplication.run(WikiIndexerStreamApplication.class, args); }}
Annotation
Purpose
@SpringBootApplication
Enables auto-configuration and component scanning
@EnableScheduling
Activates Spring’s @Scheduled task executor
@ComponentScan({"Wikicommon"})
Registers the shared Wikicommon package for Spring bean detection
Package:WikiIndexer.consumer Annotations:@Component, @Slf4jManages a KafkaConsumer that polls the recent_change_stream topic and delegates each record to OpensearchIndexer.
Polls Kafka with a 1-second timeout every 5 seconds. For each ConsumerRecord returned, extracts the Change value and calls opensearchIndexer.index(change.value()).
TRUSTED_PACKAGES is set to * to allow the JsonDeserializer to deserialize the Wikicommon.models.Change class from the shared wiki-common module without requiring an explicit package allowlist.
Package:WikiIndexer.index Annotations:@Service, @RequiredArgsConstructor, @Slf4jWrites a single Change document into the wiki-changes OpenSearch index.Field
Name
Type
Description
openSearchClient
OpenSearchClient
Injected Spring bean configured by OpensearchConfig
index(Change change)
OpensearchIndexer.java
public void index(Change change) throws Exception { openSearchClient.index(i -> i .index("wiki-changes") .id(change.getTitle()) .document(change)); log.info("Indexed Title: {}", change.getTitle());}
Issues an index request against the wiki-changes index, using the page title as the document ID. Logs the indexed title on success.
Using change.getTitle() as the document ID means that repeated edits to the same Wikipedia page will overwrite the existing document rather than create a new one. This keeps the index at one document per page.