Skip to content

Instantly share code, notes, and snippets.

@TheDeveloper
Created May 3, 2018 11:28
Show Gist options
  • Save TheDeveloper/2c9f822ae279b378263e5c0df3543daf to your computer and use it in GitHub Desktop.
Save TheDeveloper/2c9f822ae279b378263e5c0df3543daf to your computer and use it in GitHub Desktop.

Revisions

  1. TheDeveloper created this gist May 3, 2018.
    11 changes: 11 additions & 0 deletions es-search.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    const secondThing = { term: { field2: 'bar' } };
    const firstThing = { term: { field1: 'foo' } };
    const filter = [ firstThing, secondThing ];
    const bool = { filter };
    const query = { bool };
    const body = { query };
    const params = {
    index: 'your-index',
    body
    };
    const result = await es.search(params);