# How can I add a custom facet?

You can add a custom facet by extending the listing document.

For example you can add a Stock Status facet:

```php
\Aero\Search\Elastic\Documents\ListingDocument::add('string-facets', function ($document) {
    $stock = $document->getModel()->availableStock() > 0;

    return [
        \Aero\Search\Elastic\Facet::create('stock', 'Stock Status', (int) $stock, $stock ? 'In stock' : 'Out of stock'),
    ];
});
```

<p class="callout warning">You must run `php artisan aero:search:reindex --type=listing` for these document changes to be applied to existing listings.</p>

And then register it so that it appears on the listings page as a facet:

```php
\Aero\Search\FacetSettings::registerFacet('stock', 'Stock Status');
```