HPKV Nexus Search
Nexus Search: AI-Powered Search for HPKV
Nexus Search adds Retrieval Augmented Generation (RAG) capabilities to HPKV, enabling you to perform semantic search and AI-powered question answering over your key-value data. Unlike traditional key-based access, Nexus Search understands the meaning of your content, allowing natural language queries and intelligent information retrieval.
Privacy
All Nexus Search processing is private and secure. We do not maintain logs of your queries or searches, and your information is never used to train AI models or shared with third parties.
Usage Limits
Nexus Search is available on all subscription tiers with varying limits for context size, output tokens, and request rate. Please visit our pricing page for detailed information about the limits for each tier.
- Free tier: 100 calls/month, 12 req/min, no agent mode
- Pro tier: 500 calls/month, 24 req/min, no agent mode
- Business tier: 5000 calls/month, 60 req/min, with agent mode
- Enterprise tier: Unlimited calls, 120 req/min, with agent mode
How It Works
When you write data to HPKV, Nexus Search automatically processes your content:
- Your key-value data is stored in HPKV as usual
- The text content is converted into vector embeddings (numerical representations that capture meaning)
- These embeddings are stored in a specialized vector database
- When you search or query, your input is converted to the same vector format
- The system finds the most similar vectors to your query
- For queries, an AI model generates a natural language response based on the retrieved content
This process happens automatically in the background whenever you add or update data through the standard HPKV API.
Search Endpoint
The /search
endpoint returns semantically similar records to your query. Instead of exact key matching, it finds records with content related to your search terms.
Request Format
POST /search Content-Type: application/json X-Api-Key: YOUR_API_KEY { "query": "Your natural language search query", "topK": 5, // Optional: number of results to return (default: 5) "minScore": 0.65 // Optional: minimum similarity score threshold (default: 0.65) }
Parameters:
query
(required): The natural language text to search for. This can be a phrase, question, or keywords related to the content you're looking for.topK
(optional): Number of results to return, ranging from 1 to 20. Default is 5.minScore
(optional): Minimum similarity score threshold between 0 and 1. Results with scores below this value will be filtered out. Default is 0.65.
Response Format
{ "results": [ { "key": "article:123", "score": 0.87 }, { "key": "product:456", "score": 0.76 }, ... ] }
Response Fields:
results
: An array of objects containing the keys of semantically similar records and their similarity scores.key
: The key of a matching record in your HPKV store.score
: A similarity score between 0 and 1, where higher values indicate greater relevance to the query.
The score
is a similarity value between 0 and 1, where higher scores indicate greater relevance to your query.
Example
// Semantic search for relevant records
const response = await fetch(
"https://nexus.hpkv.io/search",
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
query: "What are the benefits of high performance databases?",
topK: 5, // Optional: number of results to return (default: 5)
minScore: 0.65 // Optional: minimum similarity score (default: 0.65)
})
}
);
const data = await response.json();
console.log(data.results); // Array of {key, score} objects
Query Endpoint
The /query
endpoint provides AI-generated answers to questions based on your data. It combines semantic search with large language model capabilities to produce natural language responses grounded in your content.
Request Format
POST /query Content-Type: application/json X-Api-Key: YOUR_API_KEY { "query": "Your natural language question", "topK": 5, // Optional: number of relevant records to use (default: 5) "minScore": 0.65 // Optional: minimum similarity score threshold (default: 0.65) }
Parameters:
query
(required): The natural language question you want to ask about your data. For best results, phrase this as a complete question.topK
(optional): Maximum number of relevant records to use for generating the answer, ranging from 1 to 20. Default is 5.minScore
(optional): Minimum similarity score threshold between 0 and 1. Records with scores below this value won't be used for answer generation. Default is 0.65.
Response Format
{ "answer": "The AI-generated answer to your question based on your data", "sources": [ { "key": "article:123", "score": 0.87 }, { "key": "product:456", "score": 0.76 }, ... ] }
Response Fields:
answer
: A natural language response to your question, generated by an AI model based on the content of the most relevant records.sources
: An array of objects containing the keys of records used to generate the answer and their relevance scores.key
: The key of a record in your HPKV store that was used as a source.score
: A similarity score between 0 and 1, indicating how relevant this record was to the query.
The sources
array contains the keys of records used to generate the answer, along with their relevance scores.
Example
// Get AI-generated answers from your data
const response = await fetch(
"https://nexus.hpkv.io/query",
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
query: "What are the benefits of high performance databases?",
topK: 5, // Optional: number of relevant records to use (default: 5)
minScore: 0.65 // Optional: minimum similarity score (default: 0.65)
})
}
);
const data = await response.json();
console.log(data.answer); // AI-generated answer
console.log(data.sources); // Array of source keys used for the answer
Complete Example
This example demonstrates storing data in HPKV and then querying it with Nexus Search:
// Store data in HPKV first
await fetch(`${baseUrl}/record`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
key: 'article:databases',
value: 'High performance databases offer exceptional speed and reliability. They typically achieve sub-millisecond response times and can handle millions of operations per second. This makes them ideal for real-time applications, financial systems, gaming backends, and other use cases where latency matters.'
})
});
// Wait for a moment to allow indexing (in production, data is indexed asynchronously)
await new Promise(resolve => setTimeout(resolve, 1000));
// Query the data using Nexus Search
const response = await fetch("https://nexus.hpkv.io/query", {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
query: "What applications benefit from high performance databases?"
})
});
const data = await response.json();
console.log(data.answer);
// Output might be: "High performance databases are ideal for real-time applications, financial systems, gaming backends, and other use cases where low latency is critical."
Log Analysis Example
One powerful use case for Nexus Search is analyzing log data. By storing logs in HPKV, you can use natural language to query and understand system events, troubleshoot issues, and gain insights from your logs.
Log Analysis Scenario
In this example, we've stored application logs in HPKV with timestamp-based keys. Each log entry contains information about system events, errors, and user activities.
Sample Log Data:
key: 20231004123456, value: "2023-10-04 12:34:56 INFO [WebServer] GET /index.html 200 123.456.789.012" key: 20231004123510, value: "2023-10-04 12:35:10 ERROR [WebServer] GET /nonexistent.html 404 123.456.789.012" key: 20231004123600, value: "2023-10-04 12:36:00 INFO [AuthService] User 'john_doe' authenticated successfully from IP 123.456.789.012" key: 20231004123605, value: "2023-10-04 12:36:05 WARN [AuthService] Authentication failed for user 'john_doe' from IP 123.456.789.012" key: 20231004123700, value: "2023-10-04 12:37:00 INFO [OrderService] User 'john_doe' placed an order with ID 12345" key: 20231004123705, value: "2023-10-04 12:37:05 ERROR [OrderService] Failed to process order for user 'john_doe': Insufficient funds" key: 20231004123805, value: "2023-10-04 12:38:05 ERROR [Database] Query failed: INSERT INTO orders ... - Duplicate entry" key: 20231004123900, value: "2023-10-04 12:39:00 INFO [PaymentGateway] Initiated payment for order 12345" key: 20231004123910, value: "2023-10-04 12:39:10 ERROR [PaymentGateway] Payment failed for order 12345: Invalid card number"
Example Queries:
Query: "What happened with user john_doe's order?"
{ "answer": "According to the log, here's what happened with user john_doe's order: 1. At 12:37:00, user john_doe placed an order with ID 12345. 2. At 12:37:05, the order failed to process due to insufficient funds. 3. At 12:39:00, the payment gateway initiated payment for the order. 4. At 12:39:10, the payment failed due to an invalid card number. So, unfortunately, the order was not successfully processed and paid for.", "sources": [ { "key": "20231004123700", "score": 0.8413863 }, { "key": "20231004123705", "score": 0.8051659 }, { "key": "20231004123900", "score": 0.7073802 }, { "key": "20231004123910", "score": 0.6628850 } ] }
Query: "Show me all database errors"
{ "answer": "Here are the database errors from the log: * [20231004123805]: 2023-10-04 12:38:05 ERROR [Database] Query failed: INSERT INTO orders ... - Duplicate entry These are the only database errors that occurred.", "sources": [ { "key": "20231004123800", "score": 0.7184418 }, { "key": "20231004123805", "score": 0.7179137 } ] }
Query: "What happened with the payment for order 12345?"
{ "answer": "According to the log messages: [20231004123900]: 2023-10-04 12:39:00 INFO [PaymentGateway] Initiated payment for order 12345 [20231004123910]: 2023-10-04 12:39:10 ERROR [PaymentGateway] Payment failed for order 12345: Invalid card number It appears that the payment for order 12345 was initiated, but then failed due to an invalid card number.", "sources": [ { "key": "20231004123900", "score": 0.8478195 }, { "key": "20231004123910", "score": 0.7986328 } ] }
As shown in these examples, Nexus Search allows you to ask questions about your logs in natural language and receive contextually relevant answers. This is especially powerful for:
- Troubleshooting application errors
- Tracking user activity flows
- Understanding transaction histories
- Investigating security incidents
- Analyzing system performance issues
Unlike traditional log search tools that rely on exact keyword matching or complex query languages, Nexus Search understands the semantic meaning of your logs and queries, making it easier to find relevant information.
Limitations
Current Limitations
- The embedding model only supports English text (non-English content may have reduced accuracy)
- There is a processing delay of a few seconds between when data is written to HPKV and when it becomes searchable
- Up to 20 results can be returned with a single search request
Best Practices
Recommendations for Effective Use
- Optimize content structure: Store semantically coherent chunks of information under individual keys
- Use descriptive keys: Create meaningful key naming patterns that describe the content (e.g., "article:databases" instead of "a123")
- Adjust topK values: Start with the default of 5 and adjust based on your use case
- Filter with minScore: Use higher values (0.7+) for stricter matching or lower values (0.4-0.5) for broader results
- Use specific queries: More specific questions typically yield more relevant results
- Handle updates properly: When updating content, old embeddings are automatically replaced, but allow time for processing
- Validate search results: Always validate search results before presenting them to users
- Consider query patterns: Design your data model with typical query patterns in mind