conversations
listlengths 3
3
| metadata
dict |
|---|---|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Marketing Campaigns\n\nField Mappings:\n{\n \"properties\": {\n \"ticketId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"description\": {\n \"type\": \"text\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"priority\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"assignee\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"price\": {\n \"type\": \"double\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"ticketId\": \"MC-001\",\n \"title\": \"Spring Launch Email Blast\",\n \"description\": \"Prepare and send email campaign for the spring product line.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"email\",\n \"assignee\": \"alice.smith\",\n \"createdAt\": \"2025-03-01T09:15:00Z\",\n \"price\": 1200,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"MC-002\",\n \"title\": \"Social Media Ads Q2\",\n \"description\": \"Design and schedule paid social media ads for Q2.\",\n \"status\": \"in_progress\",\n \"priority\": \"medium\",\n \"category\": \"social\",\n \"assignee\": \"bob.jones\",\n \"createdAt\": \"2025-03-05T14:30:00Z\",\n \"price\": 850.5,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"MC-003\",\n \"title\": \"Landing Page Optimization\",\n \"description\": \"A/B test new landing page layouts to improve conversion.\",\n \"status\": \"closed\",\n \"priority\": \"low\",\n \"category\": \"web\",\n \"assignee\": \"carla.lee\",\n \"createdAt\": \"2025-02-20T11:00:00Z\",\n \"price\": 600,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"MC-004\",\n \"title\": \"Influencer Partnership Outreach\",\n \"description\": \"Identify and contact influencers for brand collaboration.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"influencer\",\n \"assignee\": \"david.kim\",\n \"createdAt\": \"2025-03-10T08:45:00Z\",\n \"price\": 1500,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"MC-005\",\n \"title\": \"Quarterly Performance Report\",\n \"description\": \"Compile metrics and insights for Q1 marketing performance.\",\n \"status\": \"in_review\",\n \"priority\": \"medium\",\n \"category\": \"report\",\n \"assignee\": \"emma.wong\",\n \"createdAt\": \"2025-03-12T16:20:00Z\",\n \"price\": 400,\n \"documentContentWordsChunked\": []\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show me 31 marketing campaign tickets.\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, retrieving the first 31 tickets from the Marketing Campaigns index.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List 10 recent tickets\",\n \"dsl_type\": \"listing\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n },\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: Show 31 marketing campaign tickets\n\nRephrased Query: Retrieve a list of 31 marketing campaign tickets without any filters\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"listing\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 31,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}"
}
] |
{
"domain": "Marketing Campaigns",
"data_type": "structured",
"query_type": "listing",
"pattern": "initial",
"pattern_type": "listing",
"size": 31,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Support Ticket Catalog\n\nField Mappings:\n{\n \"properties\": {\n \"ticketId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"description\": {\n \"type\": \"text\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"priority\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"assignee\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"price\": {\n \"type\": \"float\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"ticketId\": \"TCK-1001\",\n \"title\": \"Network latency issue\",\n \"description\": \"Users experience intermittent latency on the corporate VPN.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"network\",\n \"assignee\": \"tech_support\",\n \"createdAt\": \"2024-11-10T08:15:30Z\",\n \"price\": 0\n },\n {\n \"ticketId\": \"TCK-1002\",\n \"title\": \"Software license renewal\",\n \"description\": \"Renewal of Adobe Creative Cloud licenses for design team.\",\n \"status\": \"resolved\",\n \"priority\": \"medium\",\n \"category\": \"software\",\n \"assignee\": \"procurement\",\n \"createdAt\": \"2024-10-22T14:42:10Z\",\n \"price\": 1200\n },\n {\n \"ticketId\": \"TCK-1003\",\n \"title\": \"Printer not printing\",\n \"description\": \"Office printer on 3rd floor stops printing after 50 pages.\",\n \"status\": \"open\",\n \"priority\": \"low\",\n \"category\": \"hardware\",\n \"assignee\": \"tech_support\",\n \"createdAt\": \"2024-11-12T09:05:45Z\",\n \"price\": 0\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"List highβpriority tickets.\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here are the highβpriority tickets.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List highβpriority tickets.\",\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": [\n {\n \"term\": {\n \"priority\": \"high\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: Show open tickets assigned to tech support\n\nRephrased Query: List all tickets where status is open and assignee is tech_support\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": [\n {\n \"term\": {\n \"status\": \"open\"\n }\n },\n {\n \"term\": {\n \"assignee\": \"tech_support\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}"
}
] |
{
"domain": "Support Ticket Catalog",
"data_type": "structured",
"query_type": "listing_with_filters",
"pattern": "initial",
"pattern_type": "simple_filter",
"size": 10,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Customer Support Tickets\n\nField Mappings:\n{\n \"properties\": {\n \"documentId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"author\": {\n \"type\": \"keyword\"\n },\n \"department\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"fileType\": {\n \"type\": \"keyword\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"tags\": {\n \"type\": \"keyword\"\n },\n \"confidentialityLevel\": {\n \"type\": \"keyword\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"documentId\": \"TCKT-001\",\n \"title\": \"Finance Q1 Expense Report\",\n \"author\": \"alice.smith\",\n \"department\": \"Finance\",\n \"createdAt\": \"2024-02-15T09:30:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"closed\",\n \"category\": \"expense\",\n \"tags\": [\n \"Q1\",\n \"2024\",\n \"report\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"TCKT-002\",\n \"title\": \"IT Security Policy Update\",\n \"author\": \"bob.jones\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2023-11-20T14:12:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"security\",\n \"policy\",\n \"update\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"TCKT-003\",\n \"title\": \"HR Onboarding Checklist\",\n \"author\": \"carol.lee\",\n \"department\": \"Human Resources\",\n \"createdAt\": \"2024-01-05T08:00:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"draft\",\n \"category\": \"process\",\n \"tags\": [\n \"onboarding\",\n \"HR\"\n ],\n \"confidentialityLevel\": \"public\"\n },\n {\n \"documentId\": \"TCKT-004\",\n \"title\": \"Finance Audit Findings 2023\",\n \"author\": \"david.khan\",\n \"department\": \"Finance\",\n \"createdAt\": \"2023-12-10T11:45:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"audit\",\n \"tags\": [\n \"audit\",\n \"2023\"\n ],\n \"confidentialityLevel\": \"restricted\"\n },\n {\n \"documentId\": \"TCKT-005\",\n \"title\": \"Customer Support SLA Overview\",\n \"author\": \"emma.wilson\",\n \"department\": \"Customer Support\",\n \"createdAt\": \"2024-03-01T10:20:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"sla\",\n \"tags\": [\n \"support\",\n \"sla\"\n ],\n \"confidentialityLevel\": \"public\"\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show tickets\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Here are the most recent tickets...\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"Show tickets\",\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n },\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n }\n }\n }\n]\n\nUser Query: List PDFs from Finance department after 2024\n\nRephrased Query: Retrieve PDF tickets from the Finance department created after 2024-01-01\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"hybrid_search_with_filters\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"hybrid\": {\n \"vector\": {\n \"documentContentWordsChunked.embedding\": {\n \"vector\": [\n 0,\n 0,\n 0,\n 0\n ],\n \"k\": 10\n }\n },\n \"filter\": {\n \"bool\": {\n \"must\": [\n {\n \"term\": {\n \"fileType\": \"pdf\"\n }\n },\n {\n \"term\": {\n \"department\": \"Finance\"\n }\n },\n {\n \"range\": {\n \"createdAt\": {\n \"gt\": \"2024-01-01\"\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n}"
}
] |
{
"domain": "Customer Support Tickets",
"data_type": "unstructured",
"query_type": "hybrid_search_with_filters",
"pattern": "initial",
"pattern_type": "categorical_listing",
"size": 10,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Project Management Tasks\n\nField Mappings:\n{\n \"properties\": {\n \"ticketId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"description\": {\n \"type\": \"text\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"priority\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"assignee\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"price\": {\n \"type\": \"float\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"ticketId\": \"TCK-001\",\n \"title\": \"Design login page\",\n \"description\": \"Create mockups and implement responsive login UI.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"frontend\",\n \"assignee\": \"alice\",\n \"createdAt\": \"2025-10-15T09:30:00Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"TCK-002\",\n \"title\": \"Set up CI pipeline\",\n \"description\": \"Configure Jenkins for automated builds and tests.\",\n \"status\": \"in_progress\",\n \"priority\": \"medium\",\n \"category\": \"devops\",\n \"assignee\": \"bob\",\n \"createdAt\": \"2025-10-12T14:45:00Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"TCK-003\",\n \"title\": \"Database schema migration\",\n \"description\": \"Migrate user data to new schema version 2.0.\",\n \"status\": \"closed\",\n \"priority\": \"high\",\n \"category\": \"backend\",\n \"assignee\": \"carol\",\n \"createdAt\": \"2025-09-28T11:20:00Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": []\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show tickets\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, retrieving the latest tickets for you.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List documents\",\n \"dsl_type\": \"listing\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ],\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n }\n }\n }\n]\n\nUser Query: Show tickets\n\nRephrased Query: List all tickets\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"listing\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}"
}
] |
{
"domain": "Project Management Tasks",
"data_type": "structured",
"query_type": "listing",
"pattern": "initial",
"pattern_type": "sorted_listing",
"size": 10,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Medical Records\n\nField Mappings:\n{\n \"properties\": {\n \"documentId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"author\": {\n \"type\": \"keyword\"\n },\n \"department\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"fileType\": {\n \"type\": \"keyword\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"tags\": {\n \"type\": \"keyword\"\n },\n \"confidentialityLevel\": {\n \"type\": \"keyword\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"documentId\": \"MR-001\",\n \"title\": \"Patient Admission Note\",\n \"author\": \"Dr. Alice Smith\",\n \"department\": \"Cardiology\",\n \"createdAt\": \"2023-11-15T09:30:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"final\",\n \"category\": \"clinical\",\n \"tags\": [\n \"admission\",\n \"cardiology\"\n ],\n \"confidentialityLevel\": \"high\"\n },\n {\n \"documentId\": \"MR-002\",\n \"title\": \"Radiology Report - Chest X-Ray\",\n \"author\": \"Dr. Bob Lee\",\n \"department\": \"Radiology\",\n \"createdAt\": \"2024-02-20T14:12:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"final\",\n \"category\": \"imaging\",\n \"tags\": [\n \"xray\",\n \"chest\"\n ],\n \"confidentialityLevel\": \"high\"\n },\n {\n \"documentId\": \"MR-003\",\n \"title\": \"Lab Results - Blood Panel\",\n \"author\": \"LabTech Corp\",\n \"department\": \"Pathology\",\n \"createdAt\": \"2024-05-05T08:00:00Z\",\n \"fileType\": \"csv\",\n \"status\": \"final\",\n \"category\": \"lab\",\n \"tags\": [\n \"blood\",\n \"panel\"\n ],\n \"confidentialityLevel\": \"medium\"\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show tickets\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, retrieving the first 10 documents from the Medical Records index.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List documents\",\n \"dsl_type\": \"hybrid_search\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n }\n }\n }\n]\n\nUser Query: Show tickets\n\nRephrased Query: List all documents in the Medical Records index\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"hybrid_search\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n }\n }\n}"
}
] |
{
"domain": "Medical Records",
"data_type": "unstructured",
"query_type": "hybrid_search",
"pattern": "refinement",
"pattern_type": "change_sort",
"size": 10,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Technical Manuals\n\nField Mappings:\n{\n \"properties\": {\n \"documentId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"author\": {\n \"type\": \"keyword\"\n },\n \"department\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"fileType\": {\n \"type\": \"keyword\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"tags\": {\n \"type\": \"keyword\"\n },\n \"confidentialityLevel\": {\n \"type\": \"keyword\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"documentId\": \"DOC-001\",\n \"title\": \"IT Security Policy Overview\",\n \"author\": \"alice.smith\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-02-15\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"security\",\n \"policy\",\n \"overview\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"DOC-002\",\n \"title\": \"Finance Department Expense Guidelines\",\n \"author\": \"bob.jones\",\n \"department\": \"Finance\",\n \"createdAt\": \"2023-11-30\",\n \"fileType\": \"docx\",\n \"status\": \"draft\",\n \"category\": \"guideline\",\n \"tags\": [\n \"expense\",\n \"finance\",\n \"guidelines\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"DOC-003\",\n \"title\": \"Remote Work Security Checklist\",\n \"author\": \"carol.lee\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-05-10\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"checklist\",\n \"tags\": [\n \"remote\",\n \"security\",\n \"checklist\"\n ],\n \"confidentialityLevel\": \"public\"\n },\n {\n \"documentId\": \"DOC-004\",\n \"title\": \"HR Employee Handbook\",\n \"author\": \"david.kim\",\n \"department\": \"Human Resources\",\n \"createdAt\": \"2022-08-01\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"handbook\",\n \"tags\": [\n \"employee\",\n \"handbook\",\n \"hr\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"DOC-005\",\n \"title\": \"IT Infrastructure Architecture Diagram\",\n \"author\": \"eve.wang\",\n \"department\": \"IT Operations\",\n \"createdAt\": \"2024-01-20\",\n \"fileType\": \"png\",\n \"status\": \"approved\",\n \"category\": \"diagram\",\n \"tags\": [\n \"infrastructure\",\n \"architecture\"\n ],\n \"confidentialityLevel\": \"restricted\"\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show approved policies from IT Security\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, retrieving the approved IT Security policies for you.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"What are the security policies?\",\n \"dsl_type\": \"semantic_search\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"query\": {\n \"knn\": {\n \"field\": \"documentContentWordsChunked.embedding\",\n \"query_vector\": \"<embedding_placeholder>\",\n \"k\": 10,\n \"num_candidates\": 100\n }\n }\n }\n }\n]\n\nUser Query: Show approved policies from IT Security\n\nRephrased Query: Retrieve documents where status is approved and department is IT Security\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"hybrid_search_with_filters\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"hybrid\": {\n \"query\": \"approved policies\",\n \"embedder\": \"text_embedding\",\n \"filter\": {\n \"bool\": {\n \"must\": [\n {\n \"term\": {\n \"status\": \"approved\"\n }\n },\n {\n \"term\": {\n \"department\": \"IT Security\"\n }\n }\n ]\n }\n }\n }\n }\n }\n}"
}
] |
{
"domain": "Technical Manuals",
"data_type": "unstructured",
"query_type": "hybrid_search_with_filters",
"pattern": "initial",
"pattern_type": "filtered_search",
"size": 10,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Inventory Tickets\n\nField Mappings:\n{\n \"properties\": {\n \"ticketId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"description\": {\n \"type\": \"text\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"priority\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"assignee\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"price\": {\n \"type\": \"float\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"ticketId\": \"TCK-1001\",\n \"title\": \"Network latency issue\",\n \"description\": \"Users experiencing high latency on VPN connections.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"network\",\n \"assignee\": \"tech_support\",\n \"createdAt\": \"2025-10-15T08:30:00Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Network latency issue description...\",\n \"embedding\": []\n }\n ]\n },\n {\n \"ticketId\": \"TCK-1002\",\n \"title\": \"Printer out of ink\",\n \"description\": \"Office printer in room 302 needs ink replacement.\",\n \"status\": \"closed\",\n \"priority\": \"low\",\n \"category\": \"hardware\",\n \"assignee\": \"facility_team\",\n \"createdAt\": \"2025-09-20T14:12:00Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Printer maintenance details...\",\n \"embedding\": []\n }\n ]\n },\n {\n \"ticketId\": \"TCK-1003\",\n \"title\": \"Software license renewal\",\n \"description\": \"Renew annual license for design software.\",\n \"status\": \"open\",\n \"priority\": \"medium\",\n \"category\": \"software\",\n \"assignee\": \"procurement\",\n \"createdAt\": \"2025-10-01T09:45:00Z\",\n \"price\": 1200,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"License renewal process...\",\n \"embedding\": []\n }\n ]\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"List all tickets.\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here are the tickets currently in the system.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List all tickets\",\n \"dsl_type\": \"listing_without_filters\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n },\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: Show open tickets\n\nRephrased Query: Retrieve tickets where status is open\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": [\n {\n \"term\": {\n \"status\": \"open\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}"
}
] |
{
"domain": "Inventory Tickets",
"data_type": "structured",
"query_type": "listing_with_filters",
"pattern": "initial",
"pattern_type": "filtered_search",
"size": 10,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Legal Documents\n\nField Mappings:\n{\n \"properties\": {\n \"documentId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"author\": {\n \"type\": \"keyword\"\n },\n \"department\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"fileType\": {\n \"type\": \"keyword\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"tags\": {\n \"type\": \"keyword\"\n },\n \"confidentialityLevel\": {\n \"type\": \"keyword\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"documentId\": \"DOC-001\",\n \"title\": \"IT Security Policy β Access Control\",\n \"author\": \"alice.smith\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-02-15\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"access\",\n \"control\",\n \"security\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"DOC-002\",\n \"title\": \"Finance Department β Expense Reimbursement Guidelines\",\n \"author\": \"bob.jones\",\n \"department\": \"Finance\",\n \"createdAt\": \"2023-11-30\",\n \"fileType\": \"pdf\",\n \"status\": \"draft\",\n \"category\": \"guideline\",\n \"tags\": [\n \"expense\",\n \"reimbursement\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"DOC-003\",\n \"title\": \"Remote Work Policy β General\",\n \"author\": \"carol.lee\",\n \"department\": \"Human Resources\",\n \"createdAt\": \"2024-01-10\",\n \"fileType\": \"docx\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"remote\",\n \"work\",\n \"policy\"\n ],\n \"confidentialityLevel\": \"public\"\n },\n {\n \"documentId\": \"DOC-004\",\n \"title\": \"IT Security Policy β Data Encryption\",\n \"author\": \"david.khan\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-03-05\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"encryption\",\n \"data\",\n \"security\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"DOC-005\",\n \"title\": \"Finance Department β Annual Budget Report 2024\",\n \"author\": \"emma.wilson\",\n \"department\": \"Finance\",\n \"createdAt\": \"2024-04-01\",\n \"fileType\": \"xlsx\",\n \"status\": \"approved\",\n \"category\": \"report\",\n \"tags\": [\n \"budget\",\n \"2024\"\n ],\n \"confidentialityLevel\": \"confidential\"\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show me the latest IT security policies.\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here are the most recent IT Security policies: ... (list of documents).\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List 10 recent policy documents.\",\n \"dsl_type\": \"hybrid_search\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"hybrid\": {\n \"text_expansion\": {\n \"field\": \"title\",\n \"model_id\": \"semantic-model\"\n }\n }\n }\n }\n }\n]\n\nUser Query: Show 66 approved policies from IT Security department after 2024-01-01.\n\nRephrased Query: Retrieve 66 approved policy documents of file type PDF from the IT Security department created on or after 2024-01-01.\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"hybrid_search_with_filters\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 66,\n \"from\": 0,\n \"query\": {\n \"hybrid\": {\n \"text_expansion\": {\n \"field\": \"title\",\n \"model_id\": \"semantic-model\"\n },\n \"filter\": {\n \"bool\": {\n \"must\": [\n {\n \"term\": {\n \"status\": \"approved\"\n }\n },\n {\n \"term\": {\n \"department\": \"IT Security\"\n }\n },\n {\n \"term\": {\n \"fileType\": \"pdf\"\n }\n },\n {\n \"range\": {\n \"createdAt\": {\n \"gte\": \"2024-01-01\"\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n}"
}
] |
{
"domain": "Legal Documents",
"data_type": "unstructured",
"query_type": "hybrid_search_with_filters",
"pattern": "refinement",
"pattern_type": "change_sort",
"size": 66,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Medical Records\n\nField Mappings:\n{\n \"properties\": {\n \"documentId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"author\": {\n \"type\": \"keyword\"\n },\n \"department\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"fileType\": {\n \"type\": \"keyword\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"tags\": {\n \"type\": \"keyword\"\n },\n \"confidentialityLevel\": {\n \"type\": \"keyword\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"documentId\": \"MR-001\",\n \"title\": \"Cardiology Patient Summary\",\n \"author\": \"dr.smith\",\n \"department\": \"Cardiology\",\n \"createdAt\": \"2023-11-15T09:30:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"patient_summary\",\n \"tags\": [\n \"heart\",\n \"echocardiogram\"\n ],\n \"confidentialityLevel\": \"high\"\n },\n {\n \"documentId\": \"MR-002\",\n \"title\": \"Radiology Imaging Report\",\n \"author\": \"dr.jones\",\n \"department\": \"Radiology\",\n \"createdAt\": \"2024-02-20T14:12:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"pending\",\n \"category\": \"imaging_report\",\n \"tags\": [\n \"xray\",\n \"chest\"\n ],\n \"confidentialityLevel\": \"medium\"\n },\n {\n \"documentId\": \"MR-003\",\n \"title\": \"Finance Department Budget 2025\",\n \"author\": \"finance.team\",\n \"department\": \"Finance\",\n \"createdAt\": \"2024-05-01T08:00:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"budget\",\n \"tags\": [\n \"budget\",\n \"2025\"\n ],\n \"confidentialityLevel\": \"high\"\n },\n {\n \"documentId\": \"MR-004\",\n \"title\": \"IT Security Policy Update\",\n \"author\": \"it.security\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2023-12-10T11:45:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"security\",\n \"policy\"\n ],\n \"confidentialityLevel\": \"medium\"\n },\n {\n \"documentId\": \"MR-005\",\n \"title\": \"Patient Consent Form\",\n \"author\": \"admin\",\n \"department\": \"Administration\",\n \"createdAt\": \"2024-01-18T10:20:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"consent\",\n \"tags\": [\n \"consent\",\n \"patient\"\n ],\n \"confidentialityLevel\": \"high\"\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show approved policies from IT Security\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Here is the DSL to list approved IT Security policies.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"Show approved policies from IT Security\",\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": [\n {\n \"term\": {\n \"department\": \"IT Security\"\n }\n },\n {\n \"term\": {\n \"status\": \"approved\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: List PDFs from Finance department after 2024\n\nRephrased Query: Retrieve PDF documents in the Finance department with a creation date later than 2024-01-01\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 20,\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": [\n {\n \"term\": {\n \"fileType\": \"pdf\"\n }\n },\n {\n \"term\": {\n \"department\": \"Finance\"\n }\n },\n {\n \"range\": {\n \"createdAt\": {\n \"gt\": \"2024-01-01\"\n }\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}"
}
] |
{
"domain": "Medical Records",
"data_type": "unstructured",
"query_type": "listing_with_filters",
"pattern": "pagination",
"pattern_type": "next_page",
"size": 10,
"from": 20,
"is_pagination": true
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Financial Transactions\n\nField Mappings:\n{\n \"properties\": {\n \"ticketId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"description\": {\n \"type\": \"text\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"priority\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"assignee\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"price\": {\n \"type\": \"float\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"ticketId\": \"TXN-1001\",\n \"title\": \"Invoice discrepancy for client A\",\n \"description\": \"The amount billed does not match the contract terms.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"billing\",\n \"assignee\": \"finance\",\n \"createdAt\": \"2025-10-15T09:23:00Z\",\n \"price\": 12500\n },\n {\n \"ticketId\": \"TXN-1002\",\n \"title\": \"Refund request from customer B\",\n \"description\": \"Customer requested a full refund due to product defect.\",\n \"status\": \"resolved\",\n \"priority\": \"medium\",\n \"category\": \"customer_service\",\n \"assignee\": \"support\",\n \"createdAt\": \"2025-09-30T14:45:12Z\",\n \"price\": 750\n },\n {\n \"ticketId\": \"TXN-1003\",\n \"title\": \"Monthly payroll processing\",\n \"description\": \"Process payroll for all employees for November.\",\n \"status\": \"in_progress\",\n \"priority\": \"high\",\n \"category\": \"payroll\",\n \"assignee\": \"hr\",\n \"createdAt\": \"2025-11-01T08:00:00Z\",\n \"price\": 0\n },\n {\n \"ticketId\": \"TXN-1004\",\n \"title\": \"Audit trail generation\",\n \"description\": \"Generate audit logs for all transactions in Q3.\",\n \"status\": \"open\",\n \"priority\": \"low\",\n \"category\": \"compliance\",\n \"assignee\": \"audit\",\n \"createdAt\": \"2025-10-20T11:12:45Z\",\n \"price\": 0\n },\n {\n \"ticketId\": \"TXN-1005\",\n \"title\": \"Currency conversion error\",\n \"description\": \"Incorrect conversion rate applied to foreign invoices.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"exchange\",\n \"assignee\": \"finance\",\n \"createdAt\": \"2025-11-05T16:30:22Z\",\n \"price\": 3400.5\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show open tickets assigned to finance team\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, retrieving all open tickets that are currently assigned to the finance team.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List high priority tickets\",\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": [\n {\n \"term\": {\n \"priority\": \"high\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: Show open tickets assigned to finance team\n\nRephrased Query: List tickets where status is open and assignee is finance\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": [\n {\n \"term\": {\n \"status\": \"open\"\n }\n },\n {\n \"term\": {\n \"assignee\": \"finance\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}"
}
] |
{
"domain": "Financial Transactions",
"data_type": "structured",
"query_type": "listing_with_filters",
"pattern": "initial",
"pattern_type": "categorical_listing",
"size": 10,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: Product Reviews\n\nField Mappings:\n{\n \"properties\": {\n \"documentId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"author\": {\n \"type\": \"keyword\"\n },\n \"department\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"fileType\": {\n \"type\": \"keyword\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"tags\": {\n \"type\": \"keyword\"\n },\n \"confidentialityLevel\": {\n \"type\": \"keyword\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"documentId\": \"doc-001\",\n \"title\": \"Remote Work Security Policy\",\n \"author\": \"alice.smith\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-02-15T09:30:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"remote\",\n \"security\",\n \"policy\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"doc-002\",\n \"title\": \"Financial Data Handling Guidelines\",\n \"author\": \"bob.jones\",\n \"department\": \"Finance\",\n \"createdAt\": \"2023-11-20T14:12:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"draft\",\n \"category\": \"guideline\",\n \"tags\": [\n \"finance\",\n \"data\",\n \"compliance\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"doc-003\",\n \"title\": \"Customer Feedback Summary Q1 2024\",\n \"author\": \"carol.lee\",\n \"department\": \"Marketing\",\n \"createdAt\": \"2024-04-05T08:45:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"report\",\n \"tags\": [\n \"customer\",\n \"feedback\",\n \"Q1\"\n ],\n \"confidentialityLevel\": \"public\"\n }\n]\n\nChat History:\n[]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"list 10 recent reviews\",\n \"dsl_type\": \"semantic_search\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"semantic\": {\n \"field\": \"documentContentWordsChunked.embedding\",\n \"query_vector\": [\n 0.1,\n 0.2,\n 0.3\n ],\n \"k\": 10\n }\n }\n }\n }\n]\n\nUser Query: Show 73 approved policies from IT Security\n\nRephrased Query: Retrieve 73 documents where status is approved, category is policy, and department is IT Security\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"hybrid_search_with_filters\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 73,\n \"from\": 0,\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"semantic\": {\n \"field\": \"documentContentWordsChunked.embedding\",\n \"query_vector\": [\n 0.1,\n 0.2,\n 0.3\n ],\n \"k\": 73\n }\n },\n {\n \"text_expansion\": {\n \"model_id\": \"text-embedding-ada-002\",\n \"model_text\": \"approved policy IT Security\"\n }\n }\n ],\n \"filter\": {\n \"bool\": {\n \"must\": [\n {\n \"term\": {\n \"status\": \"approved\"\n }\n },\n {\n \"term\": {\n \"category\": \"policy\"\n }\n },\n {\n \"term\": {\n \"department\": \"IT Security\"\n }\n }\n ]\n }\n }\n }\n }\n }\n}"
}
] |
{
"domain": "Product Reviews",
"data_type": "unstructured",
"query_type": "hybrid_search_with_filters",
"pattern": "initial",
"pattern_type": "sorted_listing",
"size": 73,
"from": 0,
"is_pagination": false
}
|
[
{
"from": "system",
"value": "{\n \"Reasoning\": \"high\",\n \"name\": \"OpenSearch DSL Generation Agent\",\n \"task\": \"Generate PERFECT OpenSearch DSL following EXACT template structure and size requirements.\",\n \"context\": \"Use user_query and rephrased_query together. Rephrased_query is main semantic text; retain filters from user_query.\",\n \n \"CRITICAL_RULES\": [\n \"SIZE: Use EXACT size from user query or default 10 - NO OTHER VALUES\",\n \"TEMPLATE: listing WITH filters MUST use listing_with_filters type\",\n \"FILTERS: listing_with_filters uses bool.filter array, NOT bool.must\",\n \"FROM: Default 0 for initial, calculated for pagination\",\n \"STRUCTURE: Follow template structure EXACTLY - no modifications\"\n ],\n \n \"templates\": [\n {\"name\": \"hybrid_search\", \"use_when\": \"Semantic question without filters\"},\n {\"name\": \"hybrid_search_with_filters\", \"use_when\": \"Semantic question with filters\"},\n {\"name\": \"listing\", \"use_when\": \"List ALL documents without ANY filters\"},\n {\"name\": \"listing_with_filters\", \"use_when\": \"List documents WITH filters (must use filter array)\"}\n ],\n \n \"template_selection_logic\": {\n \"step1\": \"Is query semantic (about content/meaning)? β hybrid_* types\",\n \"step2\": \"Is query listing (show/list by field values)? β listing_* types\",\n \"step3\": \"Does query have filters (status, date, author, etc)? β *_with_filters\",\n \"step4\": \"No filters at all? β base type (hybrid_search or listing)\"\n },\n \n \"size_rules\": {\n \"default\": \"10 (when user doesn't specify)\",\n \"explicit\": \"Extract from query: 'show 20', 'get 50', 'list 100'\",\n \"pagination\": \"Keep same as previous query\",\n \"examples\": {\n \"show tickets\": \"size: 10 (default)\",\n \"show 25 tickets\": \"size: 25 (explicit)\",\n \"list 100 documents\": \"size: 100 (explicit)\",\n \"next page\": \"size: same as previous\"\n }\n },\n \n \"filter_structure\": {\n \"listing_with_filters\": {\n \"correct\": {\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n },\n \"WRONG\": {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\"term\": {\"status\": \"Open\"}},\n {\"term\": {\"priority\": \"High\"}}\n ]\n }\n }\n }\n }\n },\n \n \"defaults\": {\n \"result_size\": 10,\n \"from\": 0,\n \"keyword_boost\": 4.0,\n \"neural_boost\": 3.5,\n \"neural_k\": 60,\n \"inner_hits_size\": 3\n },\n \n \"response_format\": {\n \"dsl_type\": \"EXACT: hybrid_search | hybrid_search_with_filters | listing | listing_with_filters\",\n \"dsl_query\": \"Complete OpenSearch DSL matching template structure EXACTLY\"\n }\n}"
},
{
"from": "human",
"value": "Domain Name: social_media_posts\n\nField Mappings:\n{\n \"properties\": {\n \"documentId\": {\n \"type\": \"keyword\"\n },\n \"title\": {\n \"type\": \"text\"\n },\n \"author\": {\n \"type\": \"keyword\"\n },\n \"department\": {\n \"type\": \"keyword\"\n },\n \"createdAt\": {\n \"type\": \"date\"\n },\n \"fileType\": {\n \"type\": \"keyword\"\n },\n \"status\": {\n \"type\": \"keyword\"\n },\n \"category\": {\n \"type\": \"keyword\"\n },\n \"tags\": {\n \"type\": \"keyword\"\n },\n \"confidentialityLevel\": {\n \"type\": \"keyword\"\n },\n \"documentContentWords\": {\n \"type\": \"text\"\n },\n \"documentContentWordsChunked\": {\n \"type\": \"nested\",\n \"properties\": {\n \"passage\": {\n \"type\": \"text\"\n },\n \"embedding\": {\n \"type\": \"knn_vector\",\n \"dimension\": 768\n }\n }\n }\n }\n}\n\nSample Documents:\n[\n {\n \"documentId\": \"post-001\",\n \"title\": \"Company Picnic Highlights\",\n \"author\": \"alice.smith\",\n \"department\": \"HR\",\n \"createdAt\": \"2024-06-12T14:30:00Z\",\n \"fileType\": \"image\",\n \"status\": \"published\",\n \"category\": \"event\",\n \"tags\": [\n \"picnic\",\n \"team\",\n \"fun\"\n ],\n \"confidentialityLevel\": \"public\"\n },\n {\n \"documentId\": \"post-002\",\n \"title\": \"Quarterly Security Update\",\n \"author\": \"bob.jones\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-09-01T09:00:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"security\",\n \"policy\",\n \"update\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"post-003\",\n \"title\": \"Remote Work Best Practices\",\n \"author\": \"carol.lee\",\n \"department\": \"Operations\",\n \"createdAt\": \"2024-07-20T11:15:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"draft\",\n \"category\": \"guideline\",\n \"tags\": [\n \"remote\",\n \"work\",\n \"guideline\"\n ],\n \"confidentialityLevel\": \"internal\"\n }\n]\n\nChat History:\n[]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"list documents\",\n \"dsl_type\": \"listing\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ],\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n }\n }\n }\n]\n\nUser Query: Show tickets\n\nRephrased Query: List all tickets\n\nAVAILABLE TEMPLATES:\n\nTEMPLATE: hybrid_search\nUse for: Semantic questions WITHOUT filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"match\": {\n \"documentContentWordsChunked.passage\": {\n \"query\": \"{{search_query}}\",\n \"boost\": {{keyword_boost}}\n }\n }\n },\n \"inner_hits\": {\n \"size\": {{inner_hits_size}},\n \"_source\": [\"documentContentWordsChunked.passage\"]\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"documentContentWordsChunked\",\n \"score_mode\": \"max\",\n \"query\": {\n \"neural\": {\n \"documentContentWordsChunked.embedding\": {\n \"query_text\": \"{{search_query}}\",\n \"k\": {{neural_k}},\n \"boost\": {{neural_boost}}\n }\n }\n }\n }\n }\n ]\n }\n }\n}\n\nTEMPLATE: hybrid_search_with_filters\nUse for: Semantic questions WITH filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"hybrid\": {\n \"filter\": {{filters_object}},\n \"queries\": [... same as hybrid_search ...]\n }\n }\n}\n\nTEMPLATE: listing\nUse for: List ALL documents WITHOUT ANY filters\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nTEMPLATE: listing_with_filters\nUse for: List documents WITH filters\nIMPORTANT: Use \"filter\" array inside bool, NOT \"must\"\n{\n \"_source\": {\"excludes\": [\"documentContentWordsChunked\",\"documentContentWords\"]},\n \"size\": {{result_size}},\n \"from\": {{from}},\n \"query\": {\n \"bool\": {\n \"must\": [{\"match_all\": {}}],\n \"filter\": [\n {\"term\": {\"status\": \"value\"}},\n {\"term\": {\"priority\": \"value\"}},\n {\"range\": {\"createdAt\": {\"gte\": \"date\"}}}\n ]\n }\n },\n \"sort\": [{\"createdAt\": {\"order\": \"desc\"}}]\n}\n\nSIZE EXAMPLES:\nβ
\"show tickets\" β size: 10 (default)\nβ
\"show 20 tickets\" β size: 20 (explicit in query)\nβ
\"list 50 documents\" β size: 50 (explicit in query)\nβ
\"next page\" β size: same as previous query\nβ \"show tickets\" β size: 73 (WRONG - arbitrary)\nβ \"list policies\" β size: 15 (WRONG - not specified)"
},
{
"from": "gpt",
"value": "{\n \"dsl_type\": \"listing\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}"
}
] |
{
"domain": "social_media_posts",
"data_type": "unstructured",
"query_type": "listing",
"pattern": "initial",
"pattern_type": "categorical_listing",
"size": 10,
"from": 0,
"is_pagination": false
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.