java—在ElasticSearch中使用通配符“like”检索文档

k5hmc34c  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(209)

我有一些文件标题是:

DocumentTitle: "119053_L048.pdf" , DocumentTitle: "119052_L048.pdf , DocumentTitle: "119029_L048.pdf , DocumentTitle: "119239_L048.pdf , DocumentTitle: "119314_L048-2.pdf" , DocumentTitle: "119310_L048-2.pdf" , DocumentTitle: "Application.pdf , DocumentTitle: "Abstract.pdf , DocumentTitle: "Drawing.pdf

我想使用elasticsearch查询检索以“\u l048.pdf”结尾的文档。在sql中,查询类似于:

SELECT * FROM documents_table where DocumentTitle like '%_L048.pdf';

我试过下面的弹性serach查询

URL:http://localhost:9200/document/_search?size=10000

发布数据:

{
 "_source":["DocumentSubtype","DocumentTitle","CaseID","ApplicationNumber","OpenToPublic"],
  "size" : 0,        
  "query": {
  "filtered": {
  "query": {
    "query_string": {
       "query": "OpenToPublic:true AND DocumentTitle:*_L048.pdf"
      }
    }
   }
  }
}

But it returns zero result :

{
    "took": 6,
    "timed_out": false,
    "_shards": {
        "total": 5,
        "successful": 5,
        "failed": 0
    },
    "hits": {
        "total": 0,
        "max_score": null,
        "hits": []
    }
}

有人能帮忙吗?提前谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题