Skip to content

Enable multiple items per content object for Elastic service - #148340

Merged
DonalEvans merged 2 commits into
elastic:mainfrom
DonalEvans:eis-embedding-support-multiple-items-per-content
May 5, 2026
Merged

DonalEvans merged 2 commits into
elastic:mainfrom
DonalEvans:eis-embedding-support-multiple-items-per-content

Conversation

@DonalEvans

Copy link
Copy Markdown
Contributor

Also rename supportsImageEmbeddingContent() to
supportsNonTextEmbeddingContent() since content may be audio, video or PDF, not just image.

Also rename supportsImageEmbeddingContent() to
supportsNonTextEmbeddingContent() since content may be audio, video or
PDF, not just image.
@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

Pinging @elastic/search-inference-team (Team:Search - Inference)

@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

Hi @DonalEvans, I've created a changelog YAML for you.

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

🔍 Preview links for changed docs

⏳ Building and deploying preview... View progress

This comment will be updated with preview links when the build is complete.

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

ℹ️ Important: Docs version tagging

👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.

We use applies_to tags to mark version-specific features and changes.

Expand for a quick overview

When to use applies_to tags:

✅ At the page level to indicate which products/deployments the content applies to (mandatory)
✅ When features change state (e.g. preview, ga) in a specific version
✅ When availability differs across deployments and environments

What NOT to do:

❌ Don't remove or replace information that applies to an older version
❌ Don't add new information that applies to a specific version without an applies_to tag
❌ Don't forget that applies_to tags can be used at the page, section, and inline level

🤔 Need help?

@macroscopeapp

macroscopeapp Bot commented May 5, 2026 •

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

This PR enables a new capability (multiple items per content object) for ElasticInferenceService, changing which requests pass validation vs. fail. Combined with an unresolved comment about potential validation bypass in JinaAIService, human review is warranted.

You can customize Macroscope's approvability policy. Learn more.

@DonalEvans
DonalEvans enabled auto-merge (squash) May 5, 2026 18:19
Comment on lines 212 to 215
@Override
protected boolean supportsImageEmbeddingContent() {
protected boolean supportsNonTextEmbeddingContent() {
return true;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Low jinaai/JinaAIService.java:212

supportsNonTextEmbeddingContent() returning true causes non-image non-text content to bypass the validation in doEmbeddingInfer(...). Since JinaAIActionCreator only handles text and image embeddings, other content types will trigger downstream failures instead of being rejected early with a clear error. Consider restricting this to supportsImageEmbeddingContent() so only image content is allowed through.

     @Override
-    protected boolean supportsNonTextEmbeddingContent() {
-        return true;
+    protected boolean supportsImageEmbeddingContent() {
+        return true;
     }
🤖 Copy this AI Prompt to have your agent fix this:
In file x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/JinaAIService.java around lines 212-215:

`supportsNonTextEmbeddingContent()` returning `true` causes non-image non-text content to bypass the validation in `doEmbeddingInfer(...)`. Since `JinaAIActionCreator` only handles text and image embeddings, other content types will trigger downstream failures instead of being rejected early with a clear error. Consider restricting this to `supportsImageEmbeddingContent()` so only image content is allowed through.

Evidence trail:
server/src/main/java/org/elasticsearch/inference/DataType.java (enum values TEXT, IMAGE, AUDIO, VIDEO, PDF), server/src/main/java/org/elasticsearch/inference/InferenceString.java:131-132 (isNonText = !isText, so IMAGE/AUDIO/VIDEO/PDF are all non-text), x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/SenderService.java:295 (bypass when supportsNonTextEmbeddingContent() is true), x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/JinaAIService.java:199-200 (only rejects non-text for non-multimodal models), x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntity.java:96-109 (writeInputs only handles isText and isImage, producing empty object for AUDIO/VIDEO/PDF)

@DonalEvans
DonalEvans merged commit f87644e into elastic:main May 5, 2026
39 checks passed
@DonalEvans
DonalEvans deleted the eis-embedding-support-multiple-items-per-content branch May 5, 2026 19:56
alighahramani-alig pushed a commit to alighahramani-alig/elasticsearch that referenced this pull request May 8, 2026
…#148340)

Also rename supportsImageEmbeddingContent() to
supportsNonTextEmbeddingContent() since content may be audio, video or
PDF, not just image.
henningandersen pushed a commit to henningandersen/elasticsearch that referenced this pull request May 11, 2026
…#148340)

Also rename supportsImageEmbeddingContent() to
supportsNonTextEmbeddingContent() since content may be audio, video or
PDF, not just image.
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.

3 participants