ES相关

    技术2022-07-13  80

    多层级某个字段不存在 “bool”: { “must_not”: { “nested”: { “path”: “tag_list”, “query”: { “bool”: { “filter”: { “exists”: { “field”: “tag_list.FTagId” } } } } } } }

    多层级模糊匹配搜索 {“query”:{“bool”:{“filter”:{“bool”:{“filter”:[{“term”:{“CorpUin”:2852199126}},{“term”:{“FStatus”:0}},{“nested”:{“path”:“remark_list”,“query”:{“bool”:{“filter”:[{“match_phrase”:{“remark_list.FRemark”:{“query”:“andrew_test”}}},{“match_phrase”:{“remark_list.FRemark”:{“query”:“andrew_test”,“slop”:1}}}]}}}}]}}}}}

    获取ES mapping 数据结构 GET /es_customer_qd_oa_26/_mapping

    模糊匹配 {“size”:20,“query”:{“bool”:{“filter”:[{“term”:{“CorpUin”:2852199126}},{“match_phrase”:{“FName.FName_ngram”:{“query”:“Decapititor”}}},{“match_phrase”:{“FName”:{“query”:“Decapititor”,“slop”:1}}}]}}}

    多层匹配字段存在 {“size”:“15”,“from”:0,“query”:{“bool”:{“filter”:[{“term”:{“CorpUin”:2852199126}},{“term”:{“FStatus”:0}},{“nested”:{“path”:“ext_friendship”,“query”:{“bool”:{“filter”:{“term”:{“ext_friendship.FStatus”:0}}}}}}]}}}

    Processed: 0.022, SQL: 9