elasticsearch正则表达式查询与正确结果不匹配

时间:2018-12-15 04:09:48

标签: elasticsearch

我的文档如下所示:

[  
   {  
      "Additional_Tests":"null",
      "New":"N",
      "name":"DIABETIC"
   },
   {  
      "Additional_Tests":"null",
      "New":"N",
      "name":"DIABETIS"
   },
   {  
      "Additional_Tests":"null",
      "New":"N",
      "name":"DIABETICS"
   },
   {  
      "Additional_Tests":"null",
      "New":"N",
      "name":"LIVER"
   }
]

现在,我要实现的是,当我写diabetis时,应该给我以下结果:

[  
   {  
      "Additional_Tests":"null",
      "New":"N",
      "name":"DIABETIC"
   },
   {  
      "Additional_Tests":"null",
      "New":"N",
      "name":"DIABETIS"
   },
   {  
      "Additional_Tests":"null",
      "New":"N",
      "name":"DIABETICS"
   }
]

为此,我编写了如下所示的查询:

{  
   "query":{  
      "regexp":{  
         "name":"diabetis.*"
      }
   }
}

但是以某种方式它给了我零点击,如下所示:

{ took: 0,
  timed_out: false,
  _shards: { total: 1, successful: 1, skipped: 0, failed: 0 },
  hits: { total: 0, max_score: null, hits: [] } }

那么我有什么办法可以实现?

0 个答案:

没有答案