{"repo":"danpaz/bodybuilder","free":true,"listed":false,"github":"https://github.com/danpaz/bodybuilder","clone":"git clone https://github.com/danpaz/bodybuilder.git","description":"An elasticsearch query body builder :muscle:","language":"JavaScript","stars":1247,"topics":["elasticsearch","querydsl","builder","javascript","hacktoberfest"],"license":"MIT","category":"data-pipelines","readme_excerpt":"bodybuilder An elasticsearch query body builder. Easily build complex queries for elasticsearch with a simple, predictable api. Documentation Check out the API documentation for details and examples. Use https://bodybuilder.js.org/ to test your constructions. Elasticsearch compatibility Currently aims to support the full elasticsearch query DSL for all versions. The elasticsearch 1.x query DSL is supported by providing a v1 argument when calling the build function. Install npm install bodybuilder --save Usage For each elasticsearch query body, create an instance of bodybuilder , apply the desired query/filter/aggregation clauses, and call build to retrieve the built query body. REPL Try it out on the command line using the node REPL: # Start the repl node ./node modules/bodybuilder/repl.js # The builder is available in the context variable bodybuilder bodybuilder bodybuilder().query('match', 'message', 'this is a test').build() Queries Creates a query of type queryType . Arguments The specific arguments depend on the type of query, but typically follow this pattern: queryType - The name of the query, such as 'term' or 'prefix' . fieldToQuery - The name of the field in your index to query over. searchTerm - The string to search for. Filters Creates a filtered query using filter of type filterType . Arguments The specific arguments depend on the type of filter, but typically follow this pattern: filterType - The name of the query, such as 'regexp' or 'exists' . fieldToQuery - T","default_branch":null,"files":null,"tree":[],"storefront":"/r/danpaz","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/danpaz/bodybuilder/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}