Skip to content
/ gumgum Public
forked from cubyn/gumgum

A query builder for Elastic Search designed to be elegant, flexible and extensible.

Notifications You must be signed in to change notification settings

PWFM/gumgum

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Gumgum

Gumgum is an Elastic Search query builder.

##Example Usage

Simple example

const g = require('gumgum')

const query = g.query(
    g.must(
        g.match({ type: 'rabbit' })
    ),
    g.mustNot([
        g.match({ color: 'green' }),
        g.match({ color: 'red' })
    ]),
    g.key('color',
        g.filter(g.bool(
            g.must([
                g().query.bool.should.match({ name: 'carotte' })
            ])
        ))
    )
)

console.log(g.compile())

// output:

{
  "query": {
    "must": {
      "match": {
        "type": "rabbit"
      }
    },
    "must_not": [
      {
        "match": {
          "color": "green"
        }
      },
      {
        "match": {
          "color": "red"
        }
      }
    ],
    "color": {
      "filter": {
        "bool": {
          "must": [
            {
              "query": {
                "bool": {
                  "should": {
                    "match": {
                      "name": "carotte"
                    }
                  }
                }
              }
            }
          ]
        }
      }
    }
  }
}

##Contributing

Fork it ( https://github.com/cubyn/gumgum/fork ) Create your feature branch (git checkout -b my-new-feature) Commit your changes (git commit -am 'Add some feature') Push to the branch (git push origin my-new-feature) Create a new Pull Request


Made with ♥ by Cubyn Team

About

A query builder for Elastic Search designed to be elegant, flexible and extensible.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%