Skip to content

Elasticsearch Filter Object Data Type #2870

Open
@fherbin

Description

@fherbin

hello
I'm looking for how to filter/search in a elasticsearch Object data type
this does not work :

<?php

declare(strict_types=1);

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Elasticsearch\DataProvider\Filter\TermFilter;
use App\Model\Gelec\Ouvrage;

/**
 * @ApiResource(elasticsearch=true)
 * @ApiFilter(TermFilter::class, properties={"ouvrage.code"})
 */
class OuvrageAggregate
{
    /**
     * @ApiProperty(identifier=true)
     *
     * @var string
     */
    public $id;

    /** @var Ouvrage */
    public $ouvrage;
}

the goal being to search like this:
GET /api/ouvrage_aggregates?ouvrage.code=pouet

https://www.elastic.co/guide/en/elasticsearch/reference/current/object.html#object

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions