<p>In this specific case, yes. You can filter your entry query by whether a specific matrix field has at least one block like so:</p>

<pre><code>{% set query = craft.entries({
    section: 'blog',
    myMatrixField: ':notempty:',
    limit: 10
}) %}
</code></pre>

<p>or for fields that have 0 matrix blocks in the specific field:</p>

<pre><code>{% set query = craft.entries({
    section: 'blog',
    myMatrixField: ':empty:',
    limit: 10
}) %}
</code></pre>

<p>However these are the <em>only</em> two values available for this specific field type. You cannot, for example, search for entries with 3 or more blocks.</p>

CC BY-SA 4.0
2019-10-14T21:30:37.207Z
2019-10-14T21:30:37.207Z
nicholasthompson
<p>I would like to get entries if a matrix field is used. Something like this:</p>

<pre><code>{% set query = craft.entries()
    .section('blog')
    .search('myMatrixField|length')
    .limit(10)
 %}
</code></pre>

<craft3><matrix><query>
In entries query, is there a way to check if matrix block is used?
# In entries query, is there a way to check if matrix block is used?

(Asked by: username_0 on 2019-10-14)

I would like to get entries if a matrix field is used. Something like this:
{% set query = craft.entries()
    .section('blog')
    .search('myMatrixField|length')
    .limit(10)
 %}

**Tags:** craft3, matrix, query

---

## 1 answers

### Answer by username_1 on 2019-10-14. Score: 2 | Accepted answer

In this specific case, yes. You can filter your entry query by whether a specific matrix field has at least one block like so:
{% set query = craft.entries({
    section: 'blog',
    myMatrixField: ':notempty:',
    limit: 10
}) %}

or for fields that have 0 matrix blocks in the specific field:
{% set query = craft.entries({
    section: 'blog',
    myMatrixField: ':empty:',
    limit: 10
}) %}

However these are the only two values available for this specific field type. You cannot, for example, search for entries with 3 or more blocks.


---

