Skip to content

Conversation

danpaz
Copy link
Contributor

@danpaz danpaz commented Dec 13, 2015

Adding bodybuilder as yet another option of query builders. This one supports combining query clauses using boolean queries, e.g.

new Bodybuilder().query('match', 'title', 'quick')
                 .notQuery('match', 'title', 'lazy')
                 .orQuery('match', 'title', 'brown')
                 .orQuery('match', 'title', 'dog')
                 .build()

creates

{
  "query": {
     "bool": {
        "must":     [  { "match": { "title": "quick" }} ],
        "must_not": [  { "match": { "title": "lazy"  }} ],
        "should":   [
                        { "match": { "title": "brown" }},
                        { "match": { "title": "dog"   }}
                    ]
        }
    }
}

The library is under active development (e.g. need to support the new way of combining filters and queries in the 2.0 dsl) and my hope is to draw new contributors to the project by adding it to these docs.

I have signed the CLA.

@spalger spalger self-assigned this Dec 17, 2015
spalger added a commit that referenced this pull request Dec 17, 2015
Add bodybuilder to list of query building libraries.
@spalger spalger merged commit cce2830 into elastic:master Dec 17, 2015
@spalger
Copy link
Contributor

spalger commented Dec 17, 2015

Thanks @danpaz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants