Apache Tika
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. The reference material consulted while preparing these pages is listed in the section bibliography. |
A document intake service receives files it does not control: a Word manuscript, a scanned PDF, an e-mail with a ZIP
attachment, a text file in an old encoding, a PDF renamed to .png. Apache Tika answers the two questions every such
service asks first: what is this file, and what is in it. It detects the media type of more than a thousand formats and
extracts text, metadata, embedded documents and the language through a single interface. This section is a practical,
example-driven guide to using it from Java, from the command line, as a REST or gRPC service and as a scalable Tika
Pipes pipeline that feeds search indexes and RAG systems. Versions and dates are re-verified when each page is written
and stated as of the date checked.
Running scenario: Bookshelf
Every page uses the same example, the document intake service of the Bookshelf store used by other sections, so readers can compare approaches. It receives files from publishers and readers, then extracts text and metadata for search and RAG. The sample files are original and were created for this section:
-
manuscript.docx: headings, tables, an embedded image and author metadata. -
catalogue.pdf: a tagged PDF with bookmarks, a form and a PDF attachment. -
scanned-loan-form.pdfandbook-cover.jpg: OCR and EXIF and XMP metadata. -
publisher-email.emlwith asamples.zipattachment that contains more documents: embedded and recursive parsing. -
novel.epub,reviews-es.htmlandreseñas-fr.txt: other formats, HTML and language detection. -
legacy-catalogue.txt, saved in windows-1252: charset detection. -
renamed-invoice.png, a PDF renamed to.png: detection by content, not by name.
No example uses real secrets, passwords or personal data; examples that need credentials (cloud fetchers, VLM and inference services) read them from environment variables.
Library path and service path
The section is organised around two ways of running Tika, and most real systems end up using both.
-
Library path. The Tika classes run inside your own JVM: the
Tikafacade,AutoDetectParser, content handlers,Metadataand the configuration loaded withTikaLoader. It is the simplest and the fastest route, but a parser that runs in-process shares the fate of your application: an out-of-memory error, an infinite loop or a crash caused by a hostile file is then your problem, not Tika’s. -
Service and pipeline path. Parsing happens in a separate process:
PipesForkParser, thetika-appcommand line,tika-server(REST),tika-grpcor a full Tika Pipes pipeline with fetchers and emitters. Process isolation is Tika’s own sandbox model, and it is what the official documentation recommends for untrusted input.tika-serverandtika-grpcare not security boundaries themselves: expose them only to trusted callers.
The foundations and core concepts pages teach the library path. The running and integration pages add the service path and show how both are tied together in Spring Boot, search indexing and RAG ingestion.
Version baseline
Values checked on 2026-10-12 against Maven Central, the Apache Tika website and Docker Hub.
| Component | Version used in this section |
|---|---|
Apache Tika 4.x |
4.1.0 (released 29 September 2026), the first stable 4.x release being 4.0.0 (21 August 2026). Requires Java 17 or later. No 4.2 release exists yet. |
Apache Tika 3.x |
3.3.2 (released 16 July 2026). Requires Java 11. Differences are noted on each page. |
Java |
21 or later for the examples (Tika 4.x itself needs 17, Tika 3.x needs 11) |
Spring Boot |
4.1.x, on Spring Framework 7 |
Docker image |
|
The 3.x line stays supported after 4.0, but the sources disagree on for how long. The roadmap page of the 4.1.x documentation states March 2027, while the Tika wiki roadmap states "January 2027 or 6 months after the release of 4.0.0, whichever comes first". This section uses the website date (March 2027) and the version table above, and every page that depends on it says so; check both pages before planning a migration. Version 2.x (Java 8) reached end of life in April 2025 (last release 2.9.4) and 1.x in September 2022.
The book and the official documentation
Tika in Action by Chris A. Mattmann and Jukka L. Zitting (Manning, 2011) was written for Tika 1.0. Its concepts are
still valid: media types and detection, the Parser and ContentHandler model, XHTML output, metadata and language
detection. Its code is not, because the API has changed in 2.0, 3.0 and 4.0. The pages of this section teach the
concepts the book introduced and show every API in its current form, with the book chapter cited where it helps and an
"outdated idiom to current code" table on the What’s Changed & Migration page.
The official documentation also has gaps that the pages state honestly instead of inventing APIs:
-
There is no official Spring Boot starter or Spring integration for Tika; the Spring page builds the wiring itself.
-
The
tika-appcommand line is still described as in flux for 4.x. -
The facade,
RecursiveParserWrapperfrom Java, encrypted documents, custom media types, translation and logging have little or no 4.x narrative; those pages cite the Javadoc, the 3.x guides, the wiki and the officialtika-examplemodule. -
The 4.1.x documentation site says it was generated with AI assistance and needs human review, so facts are cross-checked against the Javadoc,
CHANGES.txtand the source. -
Tika does not recover layout (reading order across columns, table structure) as layout models do.
-
Many wiki pages describe 3.x behaviour and are labelled as such.
Choose your page
Pages
The outline covers foundations, core concepts, configuration and specialised parsing, the ways of running Tika, integrations and workflows, and ends with a downloadable cheat sheet. Pages are listed in reading order.
Foundations
-
Introduction & Architecture: What Tika is, the four pillars (detection, parsing, metadata, language), the module map and when to embed it or run it as a service.
-
Setup & Installation: Maven and Gradle coordinates, the zip distributions, Docker, logging and choosing between the 3.x and 4.x lines.
-
Getting Started with the Tika Facade: The
Tikafacade’s one-liners for detection and extraction, and when to outgrow them.
Core concepts
-
Media Types & Detection: Media types, the type registry and how Tika detects a file by name, magic bytes and container structure.
-
Character Encoding Detection: The 4.x charset detection pipeline,
AutoDetectReaderand restoring the 3.x chain. -
Parser API & AutoDetectParser: The
Parsercontract,AutoDetectParser,ParseContext,TikaInputStreamspooling and encrypted documents. -
Content Handlers & Output Formats: The XHTML SAX model and the handlers that turn it into text, HTML, XML or Markdown.
-
Metadata: The
Metadataclass, typed properties, the 4.xtk:keys, metadata filters and digests. -
Embedded Documents & Recursive Parsing: Attachments, archive entries and OLE objects with
RecursiveParserWrapper, extracting their bytes and limits. -
Language Detection & Translation: N-gram language identification, CharSoup and OpenNLP, and the state of the translation API.
-
Supported Formats & Parser Families: A guided tour of the parser families, the standard and extended packages and what each extracts.
Configuration and specialised parsing
-
Configuration:
tika-config.json,TikaLoader, environment-variable secrets and migrating from the 3.x XML configuration. -
PDF Parsing:
PDFParseroptions, the 4.1pagesblock, OCR strategies, encrypted PDFs and XFA. -
OCR with Tesseract: Installing Tesseract, configuring the OCR parser and text recognizers, Tess4J and tuning.
-
VLM Parsers & Inference: Vision-language-model parsers, local model servers and the 4.1 inference engines for text and vectors.
-
Extending Tika: Custom parsers, detectors and MIME types, decorators, external parsers, OCR engines and metadata keys.
Running Tika
-
Tika App (Command Line & GUI): The
tika-appoptions, the GUI, fork mode and pipes mode, with Bookshelf examples. -
Tika Server (REST API): Every endpoint, presets, per-request configuration, backpressure, TLS, metrics and migrating from 3.x.
-
Tika gRPC: The gRPC server, its capability flags, TLS and a Java client.
-
Docker & Kubernetes Deployment: Choosing and pinning images, mounting configuration, Compose and Kubernetes sizing, probes and metrics.
-
Tika Pipes: Iterators, fetchers, emitters and reporters, parse modes, plugins and the Java API.
-
Robustness, Limits & Timeouts: Process isolation, every limit, the timeout model and testing failures with
MockParser. -
Security: The Tika security model, trust boundaries, external commands, XXE, credentials and the CVE history.
Integrations and workflows
-
Spring Boot Integration: Calling tika-server or embedding
PipesForkParserin a Spring Boot 4 upload service. -
Search Indexing with Lucene, Solr & Elasticsearch: Tika as the extraction stage of a Lucene, Solr, Elasticsearch or OpenSearch pipeline.
-
RAG & LLM Ingestion: Markdown output, embedded documents, metadata and inference vectors as the front end of a RAG pipeline.
-
tika-eval & Extraction Quality: Measuring extraction quality and comparing two configurations or versions with tika-eval.
-
Testing Tika Integrations: Fixture tests,
MockParser, golden outputs and Testcontainers server tests. -
Performance & Scaling: Choosing a deployment shape, sizing forks and scaling horizontally with 429 backpressure.
-
What’s Changed & Migration: From the book’s 1.x through 2.x and 3.x to 4.1, with an outdated-idiom-to-current-code table.
-
Cheat Sheet (PDF): A one-page printable summary of the whole section.
Bibliography
The pages of this section are written against the sources listed here, verified on 2026-10-12 and 2026-10-13 against the
versions stated in the version baseline above. Each page lists the subset it used under its own == References.
Apache Tika 4.1.x documentation
-
Using Tika: Java API, getting started, Pipes from Java, command line, server (with TLS and monitoring), gRPC and Docker.
-
Configuration, including detectors, encoding detectors, digesters, metadata filters, pages, inference and inference recipes, and the PDF, Tesseract, Tess4J, VLM, external and image parser pages.
-
Tika Pipes, including getting started, configuration, fetchers, emitters, iterators, reporters, parse modes, timeouts, performance, CPU sizing, shared-server mode, unpack configuration, troubleshooting and the plugin pages (with writing a plugin).
-
Advanced topics: robustness, setting limits, spooling, embedded documents, language detection, charset detection design, junk detection, ZIP detection, local VLM server and integration testing, all under the 4.1.x documentation.
-
Developers: custom OCR engine, metadata keys and serialization, under the 4.1.x documentation.
-
Migration to 4.x, including migrating to 4.x, migrating tika-server to 4.x, metadata changes, serialization changes, chunk strategies, inference handler requirements and the 4.x design notes.
-
Supported formats, FAQ and security.
Apache Tika 3.x guides and Javadoc
-
Apache Tika 3.3.2 guide: getting started, parser, parser guide, detection, configuring, examples and formats.
-
Javadoc: Apache Tika 4.1.0 API and Apache Tika 3.3.2 API.
Apache Tika wiki
-
TikaServer, Metadata Overview, RecursiveParserWrapper, TikaOCR, The Robustness of Apache Tika, TikaEval and Migrating to Tika 2.0.0.
-
Metadata Filters, Logging and Tika Roadmap — 2.x, 3.x and Beyond.
-
4.x Migration Guide, TikaGrpc, TikaServer Runtime Configuration in 4.x, TikaServerEndpointsCompared and API Bindings for Tika.
Apache Tika security
-
CVE records: CVE-2025-54988, CVE-2025-66516, CVE-2026-66755 and CVE-2026-66756. The last three were not listed on Tika’s own security page when checked.
Book
-
Chris A. Mattmann and Jukka L. Zitting, Tika in Action, Manning Publications, 2011 (©2012), ISBN 978-1-935182-85-6: Manning book page.
Integrations
-
Elasticsearch attachment processor and OpenSearch ingest-attachment processor.
-
Spring AI ETL pipeline (
TikaDocumentReader) and LangChain4j Apache Tika document parser. -
tika-python (third-party client, not an Apache release).