Created
July 3, 2018 06:37
-
-
Save quoeamaster/a4e505cac3d6b6eb990b3feaaa0e3b04 to your computer and use it in GitHub Desktop.
example on using elastic-builder to build queryDSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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