Skip to content

Instantly share code, notes, and snippets.

@quoeamaster
Created July 3, 2018 06:37
Show Gist options
  • Save quoeamaster/a4e505cac3d6b6eb990b3feaaa0e3b04 to your computer and use it in GitHub Desktop.
Save quoeamaster/a4e505cac3d6b6eb990b3feaaa0e3b04 to your computer and use it in GitHub Desktop.
example on using elastic-builder to build queryDSL
// Import the library
const eb = require('elastic-builder'); // the builder
// create the 'body' and add 'query' contents / conditions
const requestBody = new eb.RequestBodySearch()
.query(new eb.MatchQuery('product_desc', 'sports shoes yellow shoe laces'));
// get back the build json
//{
// "query": {
// "match": {
// "product_desc": "sports shoes yellow shoe laces"
// }
// }
//}
requestBody.toJSON()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment