database icon indicating copy to clipboard operation
database copied to clipboard

examples for elasticsearch

Open jodinathan opened this issue 4 years ago • 1 comments

Hi,

I am trying to use the ElasticSearch adapter, but I can't seem to use the exists keyword nor how to use field IN ['a', 'b']. I tried to dig the source code but couldn't find how to do it.

Can you share some examples please?

jodinathan avatar Oct 20 '20 23:10 jodinathan

found it out. It can use directly lucene syntax, ie:

final query = db.Query.parse(
    '_exists_:steps.payment_success',
    skip: 0,
    take: 1,
    sorter: db.PropertySorter.descending('updated_at'),
      schema: MapSchema({
        'name': StringSchema(),
      })
  );

final results = await collection.search(
    query: query,
  );

However, the above code is returning the whole document in results.snapshopts, is this correct?

jodinathan avatar Oct 21 '20 00:10 jodinathan

I close this because we are seeking a simpler, better design for the API and it will take some time before the package is ready for the public.

terrier989 avatar Mar 14 '23 17:03 terrier989