{ "task_data_1" : { "mappings" : { "dynamic_templates" : [ { "dates" : { "match_mapping_type" : "date", "mapping" : { "type" : "date" } } }, { "doubles" : { "match_mapping_type" : "double", "mapping" : { "type" : "double" } } }, { "objects" : { "match_mapping_type" : "object", "mapping" : { "type" : "object" } } }, { "longs" : { "match_mapping_type" : "long", "mapping" : { "type" : "integer" } } }, { "strings" : { "match" : "*", "match_mapping_type" : "string", "mapping" : { "type" : "keyword" } } } ], "properties" : { "createUsername" : { "type" : "keyword" }, "data" : { "type" : "nested", "dynamic" : "true", "properties" : { "daterange102110" : { "type" : "date" }, "input18779" : { "type" : "keyword" }, "rate48025" : { "type" : "integer" }, "textarea24212" : { "type" : "keyword" }, "textarea38172" : { "type" : "keyword" }, "timerange47544" : { "type" : "keyword" }, "url" : { "type" : "keyword" } } }, "formId" : { "type" : "long", "store" : true }, "updateUsername" : { "type" : "keyword" } } } } }
POST task_data_1/_search { "from": 0, "size": 10, "query": { "bool": { "must": [ { "term": { "input18779": { "value": "3213", "boost": 1 } } } ], "adjust_pure_negative": true, "boost": 1 } }, "sort": [ { "createTime": { "order": "desc" } } ], "track_total_hits": 2147483647 }
POST task_data_1/_search { "from": 0, "size": 10, "query": { "bool": { "must": [ { "term": { "data.input18779": { "value": "3213", "boost": 1 } } } ], "adjust_pure_negative": true, "boost": 1 } }, "sort": [ { "createTime": { "order": "desc" } } ], "track_total_hits": 2147483647 }
{ "task_data_1" : { "mappings" : { "dynamic_templates" : [ { "dates" : { "match_mapping_type" : "date", "mapping" : { "type" : "date" } } }, { "doubles" : { "match_mapping_type" : "double", "mapping" : { "type" : "double" } } }, { "objects" : { "match_mapping_type" : "object", "mapping" : { "type" : "object" } } }, { "longs" : { "match_mapping_type" : "long", "mapping" : { "type" : "integer" } } }, { "strings" : { "match" : "*", "match_mapping_type" : "string", "mapping" : { "type" : "keyword" } } } ], "properties" : { "createUsername" : { "type" : "keyword" }, "data" : { "type" : "nested", "dynamic" : "true", "properties" : { "daterange102110" : { "type" : "date" }, "input18779" : { "type" : "keyword" }, "rate48025" : { "type" : "integer" }, "textarea24212" : { "type" : "keyword" }, "textarea38172" : { "type" : "keyword" }, "timerange47544" : { "type" : "keyword" }, "url" : { "type" : "keyword" } } }, "formId" : { "type" : "long", "store" : true }, "updateUsername" : { "type" : "keyword" } } } } }
queryBuilder.must(QueryBuilders.nestedQuery("data", QueryBuilders.termQuery(queryFieldName, item.getFilterValue()), ScoreMode.None));
POST task_data_1/_search { "from": 0, "size": 10, "query": { "bool": { "must": [ { "nested": { "query": { "term": { "data.input18779": { "value": "3213", "boost": 1 } } }, "path": "data", "ignore_unmapped": false, "score_mode": "none", "boost": 1 } } ], "adjust_pure_negative": true, "boost": 1 } }, "sort": [ { "createTime": { "order": "desc" } } ], "track_total_hits": 2147483647 }
本文主要是针对KBQA方案基于LLM实现存在的问题进行优化,主要涉及到图谱存储至Es,且支持Es的向量检索,还有解决了一部分基于属性值倒查实体的场景,且效果相对提升。