0

I have been using elastisearch trough elastica recently and I am having problems using the regexp.

Here is my problem:

I need to find all instances of my "Foo" entity with the "name" NOT begin by a letter.

class Foo
{
    protected $name; // example: "1&1", "OVH", "Aliyun" ...
}

According to elasticsearch documentation, there is a "regexp" filter but I couldn't find the implementation in elastica.

I have tried:

\Elastica\Query\Prefix(); //Apparently it doesn't handle the regexp

From the documentation I could get:

$reg = '@&~(foo.+)'; # anything except string beginning with "foo"

Basically I can't find what type of query class I should use from Elastica.

Thank you for you help !

William Vbl
  • 503
  • 3
  • 8

1 Answers1

1

I don't know Elastica but a quick search pointed me to the only class that implements Regexp:

\Elastica\Filter\Regexp

And an example of it's use in the test case:

Elastica\test\lib\Elastica\Test\Filter\RegexpTest

Hope this helps!

Dean Taylor
  • 40,514
  • 3
  • 31
  • 50