Joan Triay
Joan Triay

Reputation: 1658

How I can get a simple query multimatch text in SQL in Elasticsearch?

How I can get this simple query in Elasticsearch?

SELECT * FROM [mytype] WHERE name = alex AND health = good

I'm really having troubles with its syntax, multi-match queries don't work in my case, what type of query should I use?

Upvotes: 0

Views: 137

Answers (1)

nikoshr
nikoshr

Reputation: 33364

You can use multiple must clauses in a bool query to combine queries. For example,

{
    "query": {
        "bool": {
            "must": [
                {
                    "term": {"name" : "alex"}
                },
                {
                    "term": {"health" : "good"}
                }
            ]
        }
    }
}

Upvotes: 1

Related Questions