eran
eran

Reputation: 6931

Search by prefix on concatenation of fields

Did not find an answer for this on Google.

I have json objects, which contains first_name and last_name.

I want to run search that will match if the query is prefix of first_name + last_name or last_name + first_name.

E.g. for objects:

{
     "first_name":"Leo",
     "last_name": "messi"
}
{
     "first_name":"Leo",
     "last_name": "Cohen"
}

Upvotes: 5

Views: 1633

Answers (1)

Jasper Huzen
Jasper Huzen

Reputation: 1573

I think that you can do this with a cross-field search.

See: http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_cross_fields_queries.html

Upvotes: 1

Related Questions