Skip to content

fix(indexing): record a rejected document of a data store crawl as its own failure URL - #4037

Merged
marevol merged 3 commits into
mainfrom
fix/name-rejected-documents
Dec 4, 2026
Merged

marevol merged 3 commits into
mainfrom
fix/name-rejected-documents

Conversation

@marevol

@marevol marevol commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

When the search engine rejects a document in a bulk request during a data store crawl, the failure URL does not point at it. All data configurations of a job share one callback and its document cache, and the row that happens to fill the cache sends the request. The data store catches the exception for that row and records it, possibly under another data configuration. The recorded error only carries document ids. A rejection in the last request, sent by the commit at the end of the crawl, is recorded for the data configuration only. This also happens with 15.9.0.

The warning about a rejected document and the exception, which is logged and stored in failure URLs, also repeat values of the document. Known phrases are removed, but the search engine quotes values in many more places: in the causes of a date, number, IP address, boolean, geo or range error, as the first bytes of a term that is too long, and in the reason of a rejection made by an ingest pipeline. A value that is a URL with userinfo is repeated with its password.

Change

Failure URLs:

  • The SearchEngineClientException thrown by IndexingHelper#sendDocuments for rejected documents starts with Rejected documents: <urls>. Userinfo is removed from the URLs, and only the first ten are listed, followed by the number of the others. It is now a subclass, BulkRejectedException, which also carries the URL, the configuration ID and the description of the rejection of every rejected document.
  • IndexUpdateCallbackImpl stores one failure URL for each rejected document, with its own URL, data configuration and description. This covers both the requests sent while rows are stored and the commit.
  • FailureUrlService stores nothing else for an exception that is, or is caused by, a rejection recorded this way. The data store therefore no longer adds a record for the row that filled the cache, and a failed commit or an aborted crawl no longer adds a record for the data configuration.

Description of a rejection, used in the warning, the exception message and the failure URL:

  • It consists of the status, the error type, the reason and the error type of the root cause. The text of a cause is never included.
  • The reason of the search engine is shown only for mapper_parsing_exception, strict_dynamic_mapping_exception, cluster_block_exception and a term that is too long. The preview of the field value, or of the first bytes of the term, is cut off with everything after it. Any other reason is shown as <omitted>.
  • The exception message is no longer built with BulkResponse#buildFailureMessage, which repeats every cause. It lists the index, the ID and the description of every rejected document. The protected method IndexingHelper#withoutFieldValues, which 15.9.0 has, is removed.

This loses some detail. For example, a vector of the wrong dimension is now reported as a mapping error of its field caused by an illegal_argument_exception, without the two dimensions, and a rejection of another type, such as an exceeded field limit or a failing ingest pipeline (including the message of a fail processor), shows its status and error types only.

What can still contain data of a document:

  • URLs. They are listed in the warning and the exception message without userinfo, and a failure URL stores the URL of its document as it is.
  • Names in a reason that is shown: field names (a rejection by a strict mapping names the unmapped field, which comes from the document), mapping types, index names and document IDs.
  • The rule goes by the error type, so whatever the search engine writes as the reason of the three types is shown, apart from the cut preview. In the OpenSearch 3.10.1 responses tried, those reasons held fixed text and names only (a nested mapping error of a range field quotes a key of the value, which is not shown because the text of a cause is not). Another version or a plugin of the search engine could word them differently.
  • Only these descriptions are changed. What a data store plugin logs by itself and the logs of the search engine are not.

Data store plugins need no change, and existing plugin jars work: the exception is still thrown to them. Their warnings, crawl statistics and settings that stop a crawl on an error behave as before, and a failed commit still logs an error and keeps the old documents of that data configuration.

Web and file crawls get the same exception, never marked as recorded, so their handling is unchanged; their log output differs in the class name and in the description of a rejection.

Limits:

  • A request in which very many documents are rejected stores that many records, one write each, while the shared cache is locked.
  • If one of the records cannot be stored, or the response cannot be matched with the documents, the failure is recorded by the caller as before.
  • The warning of a data store plugin, the statistics and the document count still refer to the row that filled the cache.
  • A plugin that replaces the exception with a new one that does not keep it as a cause (fess-ds-git does this when it removes credentials from a message; fix: keep document content out of the failed-file warning and record a rejection once fess-ds-git#34 handles it) still adds its own record.

Tests

  • New IndexUpdateCallbackImplRejectionTest: a rejected document of another data configuration, a rejected document that filled the cache, a commit with twelve rejected documents and wrapped exceptions, a record that cannot be stored, a response that cannot be matched, and another kind of failure.
  • New tests in FailureUrlServiceTest and IndexingHelperTest. Those for the description use error responses of OpenSearch 3.10.1 (two kinds of date format, numbers out of range, a value that looks like the preview, IP address, boolean, geo point, date range, completion, vector dimension, a term that is too long, two ingest processors, a strict mapping and a write block) and check the warning, the exception message and the description kept for the failure URL.
  • The indexing, data store callback, failure URL, data index and search engine client tests pass (403). Without the changes to IndexUpdateCallbackImpl and FailureUrlService, five of the new tests fail. With the earlier way of describing a rejection, 18 of the 52 tests in IndexingHelperTest and IndexUpdateCallbackImplRejectionTest fail, 14 of them because a value is found.

To find where values are repeated, single bad values were sent to OpenSearch 3.10.1 for these mapping types: date, date_nanos, long, integer, short, byte, float, half_float, double, scaled_float, unsigned_long, ip, boolean, geo_point, geo_shape, xy_point, integer_range, date_range, ip_range, knn_vector, keyword, object, nested, a strict mapping, binary, rank_feature, rank_features, token_count, completion, join, percolator, flat_object, wildcard, search_as_you_type, a field alias and constant_keyword; for the ingest processors date, convert, json, grok, fail, script, rename, bytes and urldecode; and for a write block, a field limit and a too long ID.

Checked on a running Fess with OpenSearch 3.10.1, with the changed classes put into a build of main and the released 15.9.0 jar of fess-ds-csv:

  • A CSV crawl of 20 rows with a rejected date value (a URL with a password), a term that is too long and a rejected number, all sent by the commit: 17 documents are indexed, there is one failure URL for each rejected document, and neither the values nor the bytes of the term are in the failure URLs or in any log of Fess. With the earlier way of describing a rejection, the date value and the bytes of the term are in both.
  • Two data configurations reading 3,000 CSV rows each, one row rejected in the middle: the other 5,999 documents are indexed and there is exactly one failure URL, with the URL and data configuration of the rejected document. The jar still logs a warning with the content of the row that filled the cache, which this change does not affect.
  • A rejected row in the last request: one failure URL for the document, the failed commit is logged as an error and the previous version of the document is kept.
  • CsvListDataStore with one rejected file: one failure URL for the file.

Checked by unit test only: web and file crawls, and data stores that stop on an error. Other data store plugins were checked by reading their error handling, not by running them.

A data store crawl records a failed bulk request as a failure URL of the
row that filled the batch, which can be another document, even of another
data configuration. The exception message now starts with the URLs of the
rejected documents (the first ten, without userinfo).
@marevol marevol added this to the 15.10.0 milestone Dec 4, 2026
All data configurations of a job share one document cache. The row that
fills it sends the bulk request, so a data store recorded a rejection for
that row, possibly under another data configuration.

The callback of the data store crawl now stores one failure URL for each
rejected document, with its URL and data configuration, and the failure URL
service stores nothing else for that exception. The exception is still
thrown to the data store, so its error handling is unchanged.
@marevol marevol changed the title fix(indexing): name the rejected documents in the bulk failure exception fix(indexing): record a rejected document of a data store crawl as its own failure URL Dec 4, 2026
… document

Problem

The warning about a rejected document, the message of the exception and
the failure URL still repeated values of the document. The search engine
quotes them in many places: the causes of a date, number, IP address,
boolean, geo or range error, the first bytes of a term that is too long,
and the reason of a rejection made by an ingest pipeline. Removing known
phrases cannot cover them.

Change

- The reason is shown only for mapper_parsing_exception,
  strict_dynamic_mapping_exception, cluster_block_exception and a term
  that is too long, without the preview of the value or of the term. Any
  other reason is shown as <omitted>.
- Of the root cause only the error type is shown.
- The message of the exception is built from these descriptions instead
  of BulkResponse#buildFailureMessage, which repeats every cause.
- Note on BulkRejectedException#isRecorded that fess-ds-git looks it up
  by name.

Tests

New tests in IndexingHelperTest use error responses of OpenSearch 3.10.1
and check the warning, the exception message and the description kept for
the failure URL. The indexing, data store callback, failure URL, data
index and search engine client tests pass (403). With the previous code,
18 of the 52 tests of IndexingHelperTest and
IndexUpdateCallbackImplRejectionTest fail, 14 because a value is found.

Checked on a running Fess with OpenSearch 3.10.1 and a CSV crawl with a
rejected date value, a term that is too long and a rejected number: none
of them is in the failure URLs or the logs of Fess. With the previous
code the date value and the bytes of the term are. Web and file crawls
were not run.
@marevol marevol self-assigned this Dec 4, 2026
@marevol
marevol merged commit f8d25e1 into main Dec 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant