Note that there are some explanatory texts on larger screens.

plurals
  1. POSearch on multiple fields with ElasticSearch with or, and operators
    primarykey
    data
    text
    <p>i`m need elasticsearch query equivalent from MySql. My sql query:</p> <pre><code>SELECT DISTINCT t.product_id AS id FROM tbl_sup_price t INNER JOIN product a ON t.product_id = a.product_id INNER JOIN a_product_to_category a2 ON a.product_id = a2.product_id INNER JOIN a_category_description a3 ON a2.category_id = a3.category_id INNER JOIN tbl_sup t2 ON t.sup_id = t2.id AND (t2.status = 1) WHERE ((t.quantity - t.reserved) &gt; 0 AND t.is_active = 1) AND (a.model_name LIKE '%word1%' OR t.name LIKE '%word1%') AND (a.model_name LIKE '%word2%' OR t.name LIKE '%word2%') ORDER BY a.price ASC </code></pre> <p>I tried a lot of options, but nothing like what I need is not found, can someone tell me how to solve this problem?</p> <p>As example: </p> <pre><code>{ "query": { "filtered": { "query": { "match_all": {} }, "filter": { "and": [ { "or": [ { "fuzzy": { "model_name": "nokian" } }, { "fuzzy": { "product_name": "nokian" } } ] }, { "or": [ { "text": { "model_name": "195" } }, { "text": { "product_name": "195" } } ] } ] } } } } </code></pre> <p>But if i run this query, i`m have error:</p> <pre><code>Parse Failure [Failed to parse source [{"query":{"filtered":{"query":{"match_all":{}},"filter":{"and":[{"or":[{"fuzzy":{"model_name":"nokian"}},{"fuzzy":{"product_name":"nokian"}}]},{"or":[{"text":{"model_name":"195"}},{"text":{"product_name":"195"}}]}]}}}}]]]; nested: QueryParsingException[[index] No filter registered for [fuzzy]]; }] </code></pre> <p>If word is numeric - search type must be text, else - fuzzy</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload