在字段串联时按前缀搜索

era*_*ran 5 elasticsearch

在Google上找不到答案。

我有json对象,其中包含first_namelast_name

如果查询的前缀是first_name + last_name或,我想运行匹配的搜索last_name + first_name

例如对象:

{
     "first_name":"Leo",
     "last_name": "messi"
}
{
     "first_name":"Leo",
     "last_name": "Cohen"
}
Run Code Online (Sandbox Code Playgroud)
  • 狮子座->应该两者都匹配
  • 狮子座m->应该匹配第一个
  • messi l->应该与第一个匹配
  • le->应该同时匹配
  • co->应该匹配第二个

Jas*_*zen 1

我认为你可以通过跨领域搜索来做到这一点。

请参阅: http ://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_cross_fields_queries.html

  • 据我所见, cross_fields 分别搜索每个字段,但不进行串联。 (2认同)