Dataset Viewer
Auto-converted to Parquet Duplicate
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 \"productId\": {\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 \"productId\": \"PRD-1001\",\n \"title\": \"Spring Sale Email Blast\",\n \"description\": \"Create and schedule email campaign for spring discount.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"email\",\n \"assignee\": \"alice\",\n \"createdAt\": \"2025-10-01T09:15:00Z\",\n \"price\": 0\n },\n {\n \"ticketId\": \"TCK-002\",\n \"productId\": \"PRD-1002\",\n \"title\": \"Social Media Ads for New Product\",\n \"description\": \"Design and launch Facebook and Instagram ads.\",\n \"status\": \"in_progress\",\n \"priority\": \"medium\",\n \"category\": \"social\",\n \"assignee\": \"bob\",\n \"createdAt\": \"2025-09-28T14:30:00Z\",\n \"price\": 1500\n },\n {\n \"ticketId\": \"TCK-003\",\n \"productId\": \"PRD-1003\",\n \"title\": \"Landing Page Optimization\",\n \"description\": \"A/B test landing page copy and layout.\",\n \"status\": \"resolved\",\n \"priority\": \"low\",\n \"category\": \"seo\",\n \"assignee\": \"carol\",\n \"createdAt\": \"2025-09-20T11:45:00Z\",\n \"price\": 0\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show open high‑priority tickets assigned to Alice\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, retrieving the requested tickets...\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List all resolved tickets from March in the email category\",\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 \"status\": \"resolved\"\n }\n },\n {\n \"range\": {\n \"createdAt\": {\n \"gte\": \"2025-03-01\",\n \"lt\": \"2025-04-01\"\n }\n }\n },\n {\n \"term\": {\n \"category\": \"email\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: Show open high‑priority tickets assigned to Alice\n\nRephrased Query: List open tickets with high priority assigned to Alice\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 \"priority\": \"high\"\n }\n },\n {\n \"term\": {\n \"assignee\": \"alice\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}" } ]
{ "domain": "Marketing Campaigns", "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: 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\",\n \"author\": \"Alice Johnson\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2023-11-15T09:30:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"security\",\n \"access\",\n \"encryption\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"DOC-002\",\n \"title\": \"Finance Quarterly Report Q1 2024\",\n \"author\": \"Bob Martinez\",\n \"department\": \"Finance\",\n \"createdAt\": \"2024-04-20T14:00:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"draft\",\n \"category\": \"report\",\n \"tags\": [\n \"quarterly\",\n \"revenue\",\n \"expenses\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"DOC-003\",\n \"title\": \"Remote Work Guidelines\",\n \"author\": \"Carol Lee\",\n \"department\": \"Human Resources\",\n \"createdAt\": \"2024-01-10T08:45:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"approved\",\n \"category\": \"guideline\",\n \"tags\": [\n \"remote\",\n \"policy\",\n \"equipment\"\n ],\n \"confidentialityLevel\": \"public\"\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"List PDFs from Finance department after 2024\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, retrieving PDF documents from Finance created after Jan 1, 2024.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List PDFs from Finance department after 2024\",\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 \"fileType\": \"pdf\"\n }\n },\n {\n \"term\": {\n \"department\": \"Finance\"\n }\n },\n {\n \"range\": {\n \"createdAt\": {\n \"gte\": \"2024-01-01T00:00:00Z\"\n }\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: Show approved policies from IT Security\n\nRephrased Query: List approved policy documents from the IT Security department\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\": \"approved\"\n }\n },\n {\n \"term\": {\n \"category\": \"policy\"\n }\n },\n {\n \"term\": {\n \"department\": \"IT Security\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}" } ]
{ "domain": "Legal Documents", "data_type": "unstructured", "query_type": "listing_with_filters", "pattern": "refinement", "pattern_type": "narrow_scope", "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: Academic Articles\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\": \"Security Policies for Remote Work\",\n \"author\": \"Dr. Alice Smith\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-03-15T09:30:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"security\",\n \"remote\",\n \"policy\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"doc-002\",\n \"title\": \"Financial Reporting Guidelines 2024\",\n \"author\": \"John Doe\",\n \"department\": \"Finance\",\n \"createdAt\": \"2024-01-20T11:00:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"draft\",\n \"category\": \"guideline\",\n \"tags\": [\n \"finance\",\n \"reporting\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"doc-003\",\n \"title\": \"Data Privacy Regulations Overview\",\n \"author\": \"Dr. Emily Zhang\",\n \"department\": \"Legal\",\n \"createdAt\": \"2023-12-05T14:45:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"approved\",\n \"category\": \"regulation\",\n \"tags\": [\n \"privacy\",\n \"data\",\n \"regulation\"\n ],\n \"confidentialityLevel\": \"public\"\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Can you list the latest security policies?\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here are the most recent approved security policies...\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"Show 10 recent documents\",\n \"dsl_type\": \"simple_match\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n }\n }\n }\n]\n\nUser Query: $Show $24 approved policies from IT Security\n\nRephrased Query: Retrieve 24 approved policy documents from the IT Security department\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\": 24,\n \"from\": 0,\n \"query\": {\n \"hybrid\": {\n \"queries\": [\n {\n \"text_expansion\": {\n \"model_id\": \"text-embedding-ada-002\",\n \"model_text\": \"approved policy IT Security\"\n }\n },\n {\n \"knn\": {\n \"field\": \"documentContentWordsChunked.embedding\",\n \"query_vector\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"k\": 24,\n \"num_candidates\": 100\n }\n }\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 }\n }\n }\n }\n }\n}" } ]
{ "domain": "Academic Articles", "data_type": "unstructured", "query_type": "hybrid_search_with_filters", "pattern": "initial", "pattern_type": "categorical_listing", "size": 24, "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\": \"TM-001\",\n \"title\": \"IT Security Policy Overview\",\n \"author\": \"alice.smith\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2023-05-12T08:30:00Z\",\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\": \"TM-002\",\n \"title\": \"Finance Department Expense Guidelines\",\n \"author\": \"bob.johnson\",\n \"department\": \"Finance\",\n \"createdAt\": \"2024-01-20T14:15:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"draft\",\n \"category\": \"guideline\",\n \"tags\": [\n \"expense\",\n \"finance\",\n \"guidelines\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"TM-003\",\n \"title\": \"Remote Work Security Checklist\",\n \"author\": \"carol.lee\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-07-03T10:00:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"approved\",\n \"category\": \"checklist\",\n \"tags\": [\n \"remote\",\n \"security\",\n \"checklist\"\n ],\n \"confidentialityLevel\": \"public\"\n },\n {\n \"documentId\": \"TM-004\",\n \"title\": \"HR Employee Onboarding Process\",\n \"author\": \"david.kim\",\n \"department\": \"Human Resources\",\n \"createdAt\": \"2023-11-11T09:45:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"process\",\n \"tags\": [\n \"onboarding\",\n \"HR\",\n \"process\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"TM-005\",\n \"title\": \"IT Infrastructure Upgrade Plan 2025\",\n \"author\": \"emma.wilson\",\n \"department\": \"IT Operations\",\n \"createdAt\": \"2024-09-15T16:20:00Z\",\n \"fileType\": \"pptx\",\n \"status\": \"planned\",\n \"category\": \"plan\",\n \"tags\": [\n \"infrastructure\",\n \"upgrade\",\n \"2025\"\n ],\n \"confidentialityLevel\": \"confidential\"\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, I will retrieve the approved policies belonging to the IT Security department.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List PDFs from Finance department after 2024\",\n \"dsl_type\": \"hybrid_search_with_filters\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"query\": {\n \"hybrid\": {\n \"text_expansion\": {\n \"title\": {\n \"model_id\": \"semantic-model-1\",\n \"model_text\": \"PDF documents\"\n }\n },\n \"filter\": {\n \"bool\": {\n \"must\": [\n {\n \"term\": {\n \"department\": \"Finance\"\n }\n },\n {\n \"term\": {\n \"fileType\": \"pdf\"\n }\n },\n {\n \"range\": {\n \"createdAt\": {\n \"gt\": \"2024-01-01\"\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n }\n]\n\nUser Query: Show approved policies from IT Security\n\nRephrased Query: List approved policy documents in the IT Security department\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\": 10,\n \"query\": {\n \"hybrid\": {\n \"text_expansion\": {\n \"title\": {\n \"model_id\": \"semantic-model-1\",\n \"model_text\": \"approved policies\"\n }\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 }\n }\n }\n }\n }\n}" } ]
{ "domain": "Technical Manuals", "data_type": "unstructured", "query_type": "hybrid_search_with_filters", "pattern": "pagination", "pattern_type": "previous_page", "size": 10, "from": 10, "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: News Articles\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\": \"Quarterly Financial Report Q1 2024\",\n \"author\": \"Jane Smith\",\n \"department\": \"Finance\",\n \"createdAt\": \"2024-04-15T09:30:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"report\",\n \"tags\": [\n \"finance\",\n \"quarterly\",\n \"2024\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"doc-002\",\n \"title\": \"IT Security Policy Update\",\n \"author\": \"Mark Lee\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-02-20T14:00:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"security\",\n \"policy\",\n \"update\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"doc-003\",\n \"title\": \"Remote Work Guidelines\",\n \"author\": \"Emily Davis\",\n \"department\": \"Human Resources\",\n \"createdAt\": \"2023-12-05T11:15:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"draft\",\n \"category\": \"guideline\",\n \"tags\": [\n \"remote\",\n \"work\",\n \"guidelines\"\n ],\n \"confidentialityLevel\": \"public\"\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show me the latest approved policies from IT Security.\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, retrieving approved policy documents from the IT Security department.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"Show recent articles\",\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": []\n }\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: List PDFs from Finance department after 2024\n\nRephrased Query: List PDF documents where department is Finance and createdAt is 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\": \"listing_with_filters\",\n \"dsl_query\": {\n \"_source\": {\n \"excludes\": [\n \"documentContentWordsChunked\",\n \"documentContentWords\"\n ]\n },\n \"size\": 10,\n \"from\": 30,\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 \"gte\": \"2024-01-01\"\n }\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}" } ]
{ "domain": "News Articles", "data_type": "unstructured", "query_type": "listing_with_filters", "pattern": "pagination", "pattern_type": "next_page", "size": 10, "from": 30, "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: Customer Profiles\n\nField Mappings:\n{\n \"properties\": {\n \"customerId\": {\n \"type\": \"keyword\"\n },\n \"name\": {\n \"type\": \"text\"\n },\n \"email\": {\n \"type\": \"keyword\"\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 \"customerId\": \"CUST001\",\n \"name\": \"Alice Johnson\",\n \"email\": \"[email protected]\",\n \"status\": \"active\",\n \"priority\": \"high\",\n \"category\": \"enterprise\",\n \"assignee\": \"sales_team_a\",\n \"createdAt\": \"2024-09-12T08:15:30Z\",\n \"price\": 1250.75,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Alice is a long‑term enterprise client interested in premium support.\",\n \"embedding\": [\n 0,\n 0,\n 0\n ]\n }\n ]\n },\n {\n \"customerId\": \"CUST002\",\n \"name\": \"Bob Smith\",\n \"email\": \"[email protected]\",\n \"status\": \"inactive\",\n \"priority\": \"low\",\n \"category\": \"small_business\",\n \"assignee\": \"account_manager_b\",\n \"createdAt\": \"2023-05-03T14:42:10Z\",\n \"price\": 300,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Bob recently cancelled his subscription due to budget constraints.\",\n \"embedding\": [\n 0,\n 0,\n 0\n ]\n }\n ]\n },\n {\n \"customerId\": \"CUST003\",\n \"name\": \"Carol Lee\",\n \"email\": \"[email protected]\",\n \"status\": \"active\",\n \"priority\": \"medium\",\n \"category\": \"mid_market\",\n \"assignee\": \"sales_team_c\",\n \"createdAt\": \"2024-02-20T11:07:45Z\",\n \"price\": 750.2,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Carol is evaluating upgrade options for her mid‑market account.\",\n \"embedding\": [\n 0,\n 0,\n 0\n ]\n }\n ]\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show me 10 customer profiles\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Here are the first 10 customer profiles matching your request.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"Show me 10 customer profiles\",\n \"dsl_type\": \"listing\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n }\n }\n }\n]\n\nUser Query: Show me 36 customer profiles\n\nRephrased Query: list 36 customer profiles 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\": 36,\n \"from\": 0,\n \"query\": {\n \"match_all\": {}\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}" } ]
{ "domain": "Customer Profiles", "data_type": "structured", "query_type": "listing", "pattern": "initial", "pattern_type": "listing", "size": 36, "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: Supplier Contracts\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\": \"SC-1001\",\n \"title\": \"Network Infrastructure Upgrade Contract\",\n \"description\": \"Contract for upgrading the supplier's network infrastructure across all regions.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"network\",\n \"assignee\": \"tech_support\",\n \"createdAt\": \"2024-09-12T08:15:30Z\",\n \"price\": 125000\n },\n {\n \"ticketId\": \"SC-1002\",\n \"title\": \"Annual Maintenance Agreement\",\n \"description\": \"Yearly maintenance contract for supplier equipment.\",\n \"status\": \"closed\",\n \"priority\": \"medium\",\n \"category\": \"maintenance\",\n \"assignee\": \"operations\",\n \"createdAt\": \"2024-03-05T14:22:10Z\",\n \"price\": 45000\n },\n {\n \"ticketId\": \"SC-1003\",\n \"title\": \"Software Licensing Renewal\",\n \"description\": \"Renewal of software licenses for supplier's ERP system.\",\n \"status\": \"in_progress\",\n \"priority\": \"low\",\n \"category\": \"software\",\n \"assignee\": \"legal\",\n \"createdAt\": \"2024-07-20T11:45:00Z\",\n \"price\": 30000\n },\n {\n \"ticketId\": \"SC-1004\",\n \"title\": \"Supply Chain Risk Assessment\",\n \"description\": \"Assessment of risks in the supplier's supply chain.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"risk\",\n \"assignee\": \"risk_management\",\n \"createdAt\": \"2024-10-01T09:30:45Z\",\n \"price\": 80000\n },\n {\n \"ticketId\": \"SC-1005\",\n \"title\": \"Logistics Optimization Project\",\n \"description\": \"Project to optimize logistics for supplier deliveries.\",\n \"status\": \"closed\",\n \"priority\": \"medium\",\n \"category\": \"logistics\",\n \"assignee\": \"logistics_team\",\n \"createdAt\": \"2024-02-18T16:05:20Z\",\n \"price\": 60000\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show open tickets\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Here are the open tickets...\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List open 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 \"status\": \"open\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: List high-priority network tickets assigned to tech support\n\nRephrased Query: Show high priority network tickets assigned to 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\": 10,\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": [\n {\n \"term\": {\n \"priority\": \"high\"\n }\n },\n {\n \"term\": {\n \"category\": \"network\"\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": "Supplier Contracts", "data_type": "structured", "query_type": "listing_with_filters", "pattern": "pagination", "pattern_type": "previous_page", "size": 10, "from": 10, "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: Sales Orders\n\nField Mappings:\n{\n \"properties\": {\n \"ticketId\": {\n \"type\": \"keyword\"\n },\n \"productId\": {\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 \"productId\": \"PRD-2001\",\n \"title\": \"Network latency issue\",\n \"description\": \"Customer reports intermittent latency on VPN connections.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"network\",\n \"assignee\": \"tech_support\",\n \"createdAt\": \"2025-10-20T08:15:30Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Network latency issue details...\",\n \"embedding\": [\n 0.1,\n 0.2,\n 0\n ]\n }\n ]\n },\n {\n \"ticketId\": \"TCK-1002\",\n \"productId\": \"PRD-2002\",\n \"title\": \"Invoice discrepancy\",\n \"description\": \"The invoice amount does not match the quoted price.\",\n \"status\": \"resolved\",\n \"priority\": \"medium\",\n \"category\": \"billing\",\n \"assignee\": \"accounting\",\n \"createdAt\": \"2025-09-15T14:42:10Z\",\n \"price\": 1250.75,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Invoice discrepancy details...\",\n \"embedding\": [\n 0.3,\n 0.4,\n 0\n ]\n }\n ]\n },\n {\n \"ticketId\": \"TCK-1003\",\n \"productId\": \"PRD-2003\",\n \"title\": \"New product order\",\n \"description\": \"Order placed for 50 units of the new model.\",\n \"status\": \"open\",\n \"priority\": \"low\",\n \"category\": \"order\",\n \"assignee\": \"sales_rep\",\n \"createdAt\": \"2025-11-01T10:05:45Z\",\n \"price\": 7500,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"New product order details...\",\n \"embedding\": [\n 0.5,\n 0.6,\n 0\n ]\n }\n ]\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show open tickets\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, retrieving all tickets with status open.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List high-priority network tickets assigned to tech support\",\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 \"term\": {\n \"category\": \"network\"\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 }\n]\n\nUser Query: Show open tickets\n\nRephrased Query: Retrieve all 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": "Sales Orders", "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 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 high latency on the corporate VPN.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"network\",\n \"assignee\": \"tech_support\",\n \"createdAt\": \"2024-10-12T08:15:30Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"TCK-1002\",\n \"title\": \"Software license renewal\",\n \"description\": \"Renewal of Adobe Creative Cloud licenses for design team.\",\n \"status\": \"closed\",\n \"priority\": \"medium\",\n \"category\": \"software\",\n \"assignee\": \"procurement\",\n \"createdAt\": \"2024-09-05T14:42:10Z\",\n \"price\": 1200,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"TCK-1003\",\n \"title\": \"Printer malfunction\",\n \"description\": \"Office printer prints blank pages intermittently.\",\n \"status\": \"open\",\n \"priority\": \"low\",\n \"category\": \"hardware\",\n \"assignee\": \"it_support\",\n \"createdAt\": \"2024-11-01T09:07:45Z\",\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\": \"Here are the first 10 tickets in the catalog.\"\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 \"_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 },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: List open high-priority network tickets assigned to tech support\n\nRephrased Query: Retrieve open tickets with high priority in the network category that are assigned to the tech_support team\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 \"priority\": \"high\"\n }\n },\n {\n \"term\": {\n \"category\": \"network\"\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": "Product Ticket Catalog", "data_type": "structured", "query_type": "listing_with_filters", "pattern": "initial", "pattern_type": "complex_query", "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\": \"Setup project repository\",\n \"description\": \"Create a new Git repository for the Alpha project and configure branch protection.\",\n \"status\": \"open\",\n \"priority\": \"medium\",\n \"category\": \"infrastructure\",\n \"assignee\": \"alice\",\n \"createdAt\": \"2025-10-20T09:15:00Z\",\n \"price\": 0\n },\n {\n \"ticketId\": \"TCK-002\",\n \"title\": \"Design UI mockups\",\n \"description\": \"Produce high‑fidelity mockups for the dashboard screens.\",\n \"status\": \"in_progress\",\n \"priority\": \"high\",\n \"category\": \"design\",\n \"assignee\": \"bob\",\n \"createdAt\": \"2025-10-18T14:30:00Z\",\n \"price\": 1500\n },\n {\n \"ticketId\": \"TCK-003\",\n \"title\": \"Implement authentication\",\n \"description\": \"Add OAuth2 login flow using the company SSO provider.\",\n \"status\": \"resolved\",\n \"priority\": \"high\",\n \"category\": \"development\",\n \"assignee\": \"carol\",\n \"createdAt\": \"2025-09-30T11:45:00Z\",\n \"price\": 2500\n },\n {\n \"ticketId\": \"TCK-004\",\n \"title\": \"Conduct security audit\",\n \"description\": \"Perform a penetration test on the new API endpoints.\",\n \"status\": \"open\",\n \"priority\": \"critical\",\n \"category\": \"security\",\n \"assignee\": \"dave\",\n \"createdAt\": \"2025-10-22T08:00:00Z\",\n \"price\": 3000\n },\n {\n \"ticketId\": \"TCK-005\",\n \"title\": \"Prepare release notes\",\n \"description\": \"Compile changelog for version 1.2.0 and distribute to stakeholders.\",\n \"status\": \"closed\",\n \"priority\": \"low\",\n \"category\": \"documentation\",\n \"assignee\": \"eve\",\n \"createdAt\": \"2025-09-25T16:20:00Z\",\n \"price\": 0\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\": \"show tickets\",\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 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\": 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: 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\": \"Invoice discrepancy for Q1\",\n \"author\": \"alice.smith\",\n \"department\": \"Finance\",\n \"createdAt\": \"2024-02-15T09:30:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"open\",\n \"category\": \"billing\",\n \"tags\": [\n \"invoice\",\n \"q1\",\n \"discrepancy\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"TCKT-002\",\n \"title\": \"Access request for HR portal\",\n \"author\": \"bob.jones\",\n \"department\": \"HR\",\n \"createdAt\": \"2023-11-20T14:12:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"closed\",\n \"category\": \"access\",\n \"tags\": [\n \"hr\",\n \"portal\",\n \"access\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"TCKT-003\",\n \"title\": \"Server outage incident report\",\n \"author\": \"carol.lee\",\n \"department\": \"IT\",\n \"createdAt\": \"2024-01-05T22:45:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"resolved\",\n \"category\": \"incident\",\n \"tags\": [\n \"server\",\n \"outage\",\n \"report\"\n ],\n \"confidentialityLevel\": \"restricted\"\n },\n {\n \"documentId\": \"TCKT-004\",\n \"title\": \"Policy update: Remote work guidelines\",\n \"author\": \"dave.kim\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2024-03-10T08:00:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"remote\",\n \"work\",\n \"guidelines\"\n ],\n \"confidentialityLevel\": \"public\"\n },\n {\n \"documentId\": \"TCKT-005\",\n \"title\": \"Expense reimbursement request\",\n \"author\": \"eve.wong\",\n \"department\": \"Finance\",\n \"createdAt\": \"2023-12-30T11:20:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"pending\",\n \"category\": \"expense\",\n \"tags\": [\n \"reimbursement\",\n \"expense\"\n ],\n \"confidentialityLevel\": \"internal\"\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Can you show me the latest security policies?\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here are the most recent security policy documents.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"Find all open tickets in the Finance department\",\n \"dsl_type\": \"hybrid_search_with_filters\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"hybrid\": {\n \"vector\": {\n \"field\": \"documentContentWordsChunked.embedding\",\n \"query_vector\": [\n 0\n ],\n \"k\": 10\n },\n \"filter\": {\n \"bool\": {\n \"must\": [\n {\n \"term\": {\n \"status\": \"open\"\n }\n },\n {\n \"term\": {\n \"department\": \"Finance\"\n }\n }\n ]\n }\n }\n }\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 January 1, 2024\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 \"field\": \"documentContentWordsChunked.embedding\",\n \"query_vector\": [\n 0\n ],\n \"k\": 10\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 \"gte\": \"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": "keyword_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: HR Employee Records\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 \"salary\": {\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\": \"HR-001\",\n \"title\": \"Benefits enrollment issue\",\n \"description\": \"Employee cannot enroll in health benefits for the upcoming year.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"Benefits\",\n \"assignee\": \"john.doe\",\n \"createdAt\": \"2024-10-01T08:15:30Z\",\n \"salary\": 75000\n },\n {\n \"ticketId\": \"HR-002\",\n \"title\": \"Payroll discrepancy\",\n \"description\": \"Incorrect overtime payment on last month’s paycheck.\",\n \"status\": \"resolved\",\n \"priority\": \"medium\",\n \"category\": \"Payroll\",\n \"assignee\": \"jane.smith\",\n \"createdAt\": \"2024-09-20T14:42:10Z\",\n \"salary\": 82000\n },\n {\n \"ticketId\": \"HR-003\",\n \"title\": \"Access request for HR portal\",\n \"description\": \"New hire needs access to the employee self‑service portal.\",\n \"status\": \"open\",\n \"priority\": \"low\",\n \"category\": \"Onboarding\",\n \"assignee\": \"john.doe\",\n \"createdAt\": \"2024-10-05T11:03:45Z\",\n \"salary\": 68000\n },\n {\n \"ticketId\": \"HR-004\",\n \"title\": \"Leave balance correction\",\n \"description\": \"Annual leave balance not updated after recent vacation.\",\n \"status\": \"in_progress\",\n \"priority\": \"high\",\n \"category\": \"Leave Management\",\n \"assignee\": \"alice.wang\",\n \"createdAt\": \"2024-09-28T09:27:00Z\",\n \"salary\": 77000\n },\n {\n \"ticketId\": \"HR-005\",\n \"title\": \"Employee data privacy request\",\n \"description\": \"Request to delete personal data per GDPR.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"Compliance\",\n \"assignee\": \"john.doe\",\n \"createdAt\": \"2024-10-03T16:58:20Z\",\n \"salary\": 88000\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show open tickets assigned to John.\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Here are the open tickets currently assigned to John.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"Show open tickets assigned to John.\",\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 \"status\": \"open\"\n }\n },\n {\n \"term\": {\n \"assignee\": \"john.doe\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: List open HR tickets assigned to John in the Benefits category\n\nRephrased Query: Show open tickets where assignee is john.doe and category is Benefits\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\": 10,\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\": \"john.doe\"\n }\n },\n {\n \"term\": {\n \"category\": \"Benefits\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}" } ]
{ "domain": "HR Employee Records", "data_type": "structured", "query_type": "listing_with_filters", "pattern": "pagination", "pattern_type": "specific_page", "size": 10, "from": 10, "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: 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\": \"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\": \"Spring Sale Email Blast\",\n \"description\": \"Create and schedule email campaign for Spring promotion.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"email\",\n \"assignee\": \"alice.smith\",\n \"createdAt\": \"2024-09-12T08:15:30Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Spring Sale Email Blast content draft...\",\n \"embedding\": null\n }\n ]\n },\n {\n \"ticketId\": \"TCK-002\",\n \"title\": \"Facebook Ads for New Product\",\n \"description\": \"Design ad creatives and set targeting for the new product launch.\",\n \"status\": \"in_progress\",\n \"priority\": \"medium\",\n \"category\": \"social_media\",\n \"assignee\": \"bob.jones\",\n \"createdAt\": \"2024-09-10T14:42:10Z\",\n \"price\": 1500,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Facebook ad copy and image specs...\",\n \"embedding\": null\n }\n ]\n },\n {\n \"ticketId\": \"TCK-003\",\n \"title\": \"Quarterly Performance Report\",\n \"description\": \"Compile metrics and insights for Q3 marketing performance.\",\n \"status\": \"closed\",\n \"priority\": \"low\",\n \"category\": \"reporting\",\n \"assignee\": \"carla.lee\",\n \"createdAt\": \"2024-08-30T09:05:45Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": [\n {\n \"passage\": \"Q3 performance data and analysis...\",\n \"embedding\": null\n }\n ]\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show tickets\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, I will list the 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": "Marketing Campaigns", "data_type": "structured", "query_type": "listing", "pattern": "initial", "pattern_type": "listing_query", "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: Ticket Management\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 outage in building A\",\n \"description\": \"Users report loss of connectivity on floor 3.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"network\",\n \"assignee\": \"tech support\",\n \"createdAt\": \"2025-10-20T08:15:30Z\",\n \"price\": 0\n },\n {\n \"ticketId\": \"TCK-1002\",\n \"title\": \"Software license renewal\",\n \"description\": \"Renewal needed for accounting software.\",\n \"status\": \"closed\",\n \"priority\": \"medium\",\n \"category\": \"software\",\n \"assignee\": \"procurement\",\n \"createdAt\": \"2025-09-15T14:42:10Z\",\n \"price\": 1200\n },\n {\n \"ticketId\": \"TCK-1003\",\n \"title\": \"Printer malfunction on 2nd floor\",\n \"description\": \"Paper jam recurring every hour.\",\n \"status\": \"open\",\n \"priority\": \"low\",\n \"category\": \"hardware\",\n \"assignee\": \"facility team\",\n \"createdAt\": \"2025-10-22T11:05:45Z\",\n \"price\": 0\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show open tickets\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Here are the open tickets...\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List closed 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 \"status\": \"closed\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: Show open high-priority tickets assigned to tech support\n\nRephrased Query: List open tickets with priority high assigned to 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 \"priority\": \"high\"\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": "Ticket Management", "data_type": "structured", "query_type": "listing_with_filters", "pattern": "initial", "pattern_type": "complex_query", "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\": \"Finance Policy 2024\",\n \"author\": \"Jane Smith\",\n \"department\": \"Finance\",\n \"createdAt\": \"2024-02-15T09:30:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"approved\",\n \"category\": \"policy\",\n \"tags\": [\n \"budget\",\n \"compliance\"\n ],\n \"confidentialityLevel\": \"internal\"\n },\n {\n \"documentId\": \"DOC-002\",\n \"title\": \"IT Security Guidelines\",\n \"author\": \"John Doe\",\n \"department\": \"IT Security\",\n \"createdAt\": \"2023-11-01T14:00:00Z\",\n \"fileType\": \"docx\",\n \"status\": \"approved\",\n \"category\": \"guideline\",\n \"tags\": [\n \"encryption\",\n \"access control\"\n ],\n \"confidentialityLevel\": \"confidential\"\n },\n {\n \"documentId\": \"DOC-003\",\n \"title\": \"Remote Work Agreement\",\n \"author\": \"Emily Johnson\",\n \"department\": \"HR\",\n \"createdAt\": \"2024-01-20T08:45:00Z\",\n \"fileType\": \"pdf\",\n \"status\": \"draft\",\n \"category\": \"agreement\",\n \"tags\": [\n \"remote\",\n \"policy\"\n ],\n \"confidentialityLevel\": \"public\"\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 are the 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: List PDF documents where department is Finance and createdAt is 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\": \"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 \"fileType\": \"pdf\"\n }\n },\n {\n \"term\": {\n \"department\": \"Finance\"\n }\n },\n {\n \"range\": {\n \"createdAt\": {\n \"gte\": \"2024-01-01\"\n }\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n}" } ]
{ "domain": "Legal Documents", "data_type": "unstructured", "query_type": "listing_with_filters", "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: HR Employee Records\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\": \"Network latency issue\",\n \"description\": \"Users experiencing high latency on internal VPN.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"network\",\n \"assignee\": \"tech support\",\n \"createdAt\": \"2024-10-12T08:15:30Z\",\n \"price\": 0\n },\n {\n \"ticketId\": \"TCK-002\",\n \"title\": \"Payroll discrepancy\",\n \"description\": \"Incorrect salary amount for employee ID 4521.\",\n \"status\": \"resolved\",\n \"priority\": \"medium\",\n \"category\": \"finance\",\n \"assignee\": \"hr specialist\",\n \"createdAt\": \"2024-09-28T14:42:10Z\",\n \"price\": 0\n },\n {\n \"ticketId\": \"TCK-003\",\n \"title\": \"Access request for HR portal\",\n \"description\": \"New hire needs access to employee records.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"access\",\n \"assignee\": \"it admin\",\n \"createdAt\": \"2024-10-01T09:05:45Z\",\n \"price\": 0\n },\n {\n \"ticketId\": \"TCK-004\",\n \"title\": \"Office chair replacement\",\n \"description\": \"Ergonomic chair needed for employee with back pain.\",\n \"status\": \"in_progress\",\n \"priority\": \"low\",\n \"category\": \"facilities\",\n \"assignee\": \"facilities team\",\n \"createdAt\": \"2024-09-20T11:30:00Z\",\n \"price\": 250\n },\n {\n \"ticketId\": \"TCK-005\",\n \"title\": \"Email delivery failure\",\n \"description\": \"External emails bouncing back from domain example.com.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"network\",\n \"assignee\": \"tech support\",\n \"createdAt\": \"2024-10-10T16:22:18Z\",\n \"price\": 0\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show open tickets\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Here are the open tickets in the system.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"Show open 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 \"status\": \"open\"\n }\n }\n ]\n }\n },\n \"sort\": [\n {\n \"createdAt\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n }\n]\n\nUser Query: List high-priority network tickets assigned to tech support\n\nRephrased Query: Retrieve tickets with status open, priority high, category network, and assignee 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 \"priority\": \"high\"\n }\n },\n {\n \"term\": {\n \"category\": \"network\"\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": "HR Employee Records", "data_type": "structured", "query_type": "listing_with_filters", "pattern": "initial", "pattern_type": "complex_query", "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: Supplier Contracts\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\": \"Contract renewal for Supplier A\",\n \"description\": \"Negotiation for renewal of the annual supply contract with Supplier A.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"contract\",\n \"assignee\": \"john.doe\",\n \"createdAt\": \"2024-09-01T10:15:00Z\",\n \"price\": 15000,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"TCK-002\",\n \"title\": \"Closed contract for Supplier B\",\n \"description\": \"Completed contract for one-time purchase from Supplier B.\",\n \"status\": \"closed\",\n \"priority\": \"low\",\n \"category\": \"purchase\",\n \"assignee\": \"jane.smith\",\n \"createdAt\": \"2024-07-20T14:30:00Z\",\n \"price\": 8200.5,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"TCK-003\",\n \"title\": \"Pending amendment for Supplier C\",\n \"description\": \"Amendment request pending approval for Supplier C's service agreement.\",\n \"status\": \"open\",\n \"priority\": \"medium\",\n \"category\": \"amendment\",\n \"assignee\": \"alice.wang\",\n \"createdAt\": \"2024-08-15T09:45:00Z\",\n \"price\": 4300,\n \"documentContentWordsChunked\": []\n }\n]\n\nChat History:\n[]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"List high-priority network tickets assigned to tech support\",\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 \"term\": {\n \"category\": \"network\"\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 }\n]\n\nUser Query: Show open tickets\n\nRephrased Query: List all 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": "Supplier Contracts", "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: Inventory Items\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\": \"Router failure in Data Center\",\n \"description\": \"The main router in rack 12 is down, causing network outage.\",\n \"status\": \"open\",\n \"priority\": \"high\",\n \"category\": \"network\",\n \"assignee\": \"tech_support\",\n \"createdAt\": \"2025-10-20T08:15:30Z\",\n \"price\": 0,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"TCK-1002\",\n \"title\": \"Laptop battery replacement\",\n \"description\": \"User reports rapid battery drain on laptop model X200.\",\n \"status\": \"closed\",\n \"priority\": \"low\",\n \"category\": \"hardware\",\n \"assignee\": \"field_engineer\",\n \"createdAt\": \"2025-09-15T14:42:10Z\",\n \"price\": 120.5,\n \"documentContentWordsChunked\": []\n },\n {\n \"ticketId\": \"TCK-1003\",\n \"title\": \"Software license renewal\",\n \"description\": \"Renew annual license for accounting software.\",\n \"status\": \"open\",\n \"priority\": \"medium\",\n \"category\": \"software\",\n \"assignee\": \"procurement\",\n \"createdAt\": \"2025-11-01T09:00:00Z\",\n \"price\": 2500,\n \"documentContentWordsChunked\": []\n }\n]\n\nChat History:\n[\n {\n \"role\": \"user\",\n \"content\": \"Show 10 tickets\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Here is a sample DSL for listing 10 tickets.\"\n }\n]\n\nPrevious DSL History:\n[\n {\n \"user_query\": \"Show 10 tickets\",\n \"dsl_type\": \"listing_with_filters\",\n \"dsl_query\": {\n \"size\": 10,\n \"from\": 0,\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ],\n \"filter\": []\n }\n }\n }\n }\n]\n\nUser Query: Show 52 open high-priority network tickets assigned to tech support\n\nRephrased Query: List 52 tickets where status is open, priority is high, category is network, 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\": 52,\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 \"priority\": \"high\"\n }\n },\n {\n \"term\": {\n \"category\": \"network\"\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": "Inventory Items", "data_type": "structured", "query_type": "listing_with_filters", "pattern": "initial", "pattern_type": "sorted_listing", "size": 52, "from": 0, "is_pagination": false }
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
25