0
votes

I have a field in elasticsearch which is defined as an array with the following mapping:

"skills":{"type":"text","term_vector": "yes"}

It contains an array of multiple skills. Suppose i want to match multiple skills, and check which document contains the skills, how would i do that in a single function?

For example, suppose i need to search for skills such as "python", "ruby" and "C", instead of writing 3 match queries, is there any way it can be combined in 1 query, like the multi_match query which is used to match multiple fields?

1

1 Answers

0
votes

multi_match isn't helpful here, since what you are searching for is all in the same field. Assuming you are analyzing with the standard analyzer, or something broadly similar, a simple match query ought to do the job:

"query": {
    "match" : {
        "skills" : "python ruby c"
    }
}

Combining your subqueries using a bool query would be another option.