davsclaus opened a new pull request, #3385:
URL: https://github.com/apache/camel-kamelets/pull/3385

   A review of the four Elasticsearch and OpenSearch Kamelets before the 4.24 
release (#3384). The search actions are new in 4.24 (#3380, Preview), so their 
output can still change.
   
   ## Kamelets
   
   - **`elasticsearch-index-sink`, `elasticsearch-search-action`:** a new 
`sslContextParameters` option, like the OpenSearch Kamelets have. It is for a 
client certificate (mutual TLS), a trust store or a TLS version.
   - **`opensearch-index-sink`, `opensearch-search-action`:** the example host 
is now `opensearch-cluster-master:9200`. It was `quickstart-es-http:9200`, 
which is the naming of the Elasticsearch operator.
   - **`elasticsearch-search-action`, `opensearch-search-action`:**
     - **`_id`:** each document found has its id added as `_id`, such as 
`[{"name": "Alice Smith", "city": "Oslo", "_id": "1"}]`, so that a flow can 
update or link the document it found. A document cannot hold its own `_id` 
field (Elasticsearch and OpenSearch refuse it), so the name cannot clash.
     - **New `queryDsl` option (default `true`):** when it is `false`, every 
body is searched for as words, also one that starts with `{`. That way, whoever 
writes the body cannot run other queries. The descriptions recommend it for 
untrusted input, and for an AI agent calling through `ai-tool-source`.
     - **Vector search:** the descriptions show a vector (`knn`) search. In 
OpenSearch, `k` is counted per segment, so more than `k` documents can match; 
the description says so.
   - **Index sinks:** they no longer depend on `camel:gson` (left over from 
2021; the template uses Jackson).
   
   ## Tests (`SearchIT#elasticsearch+opensearch`)
   
   - **Index sinks log in:**
     - Elasticsearch runs with security on, plain HTTP and the user `elastic`.
     - OpenSearch runs with the security plugin and the user `admin`. The test 
waits for `Node '...' initialized`, which the security plugin logs once its 
configuration is loaded. Before that, a login gets "Connection reset".
     - TLS with `certificate` is still not covered, because the CA file would 
have to be copied out of the container.
   - **Search actions:**
     - the expected bodies have `_id`;
     - with `queryDsl: false`, `{"match_all": {}}` is searched for as words and 
finds nothing;
     - a vector search on an index of 3-number vectors finds the closest 
document (`dense_vector` for Elasticsearch, `knn_vector` with `index.knn` for 
OpenSearch).
   - Both Elasticsearch tests now use `elasticsearch:9.1.0` from Docker Hub.
   
   Local results:
   - `./mvnw clean install -DskipITs` passes.
   - `SearchIT#elasticsearch+opensearch` passes: 4 tests, 0 failures, 
2026-11-23.
   
   ## How-to page
   
   `docs/modules/ROOT/pages/ask-your-documents.adoc`, linked from the index 
page, shows how to answer questions about your own documents (RAG) with 
Kamelets:
   - `openai:embeddings` turns texts into vectors;
   - `elasticsearch-index-sink` stores them;
   - `elasticsearch-search-action` does the vector search;
   - `openai-chat-action` answers from what was found.
   
   I ran it by hand exactly as written, with Elasticsearch 9.1, and with 
Ollama's `embeddinggemma:300m` and `granite4:3b`. It answered the four 
questions right: the return period from `returns.txt`, free shipping from 
`shipping.txt`, "we do not ship to Norway" from "all countries in the EU", and 
"I do not know" for a question outside the documents.
   
   `llama3.2` got the first question right only 2 times out of 5 with the right 
document in front of it, so the page uses `granite4:3b`, which got it right 5 
times out of 5. The OpenSearch section was not run as a whole; its index and 
`knn` query are the ones the CI test runs.
   
   Found while doing this: `curl -d` without a `Content-Type` sends the 
question as a form. platform-http then turns the question into a header name, 
and the reply fails with an HTTP 500 (`a header name cannot contain some 
prohibited characters`). The page sets `Content-Type: text/plain`. I'll raise 
the Camel side separately.
   
   ## Upgrade note
   
   - `elasticsearch-index-sink` has a new option `sslContextParameters`, for 
TLS settings that `certificate` cannot give.
   
   The changes to the search actions are part of their entry as new Kamelets 
(#3380).
   
   Not in this PR: API key login (item 7) needs an `apiKey` option in the Camel 
components first. It is asked for in apache/camel; the Kamelet option follows 
when it is in a snapshot.
   
   Fixes #3384.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to