Questions tagged [bodybuilder.js]

`bodybuilder.js` is a Javascript library that helps generate JSON for the elastic search DSL.

bodybuilder.js is a Javascript library that helps generate JSON for the Elasticsearch DSL.

It uses a builder pattern where each function returns an object with all functions, to then be fluently chained together.

11 questions
5
votes
3 answers

String.Format failing on style section of HTML Email Template

I am sending HTML email template using Bodybuilder and a mail sending service. I used this link learn. https://www.c-sharpcorner.com/article/send-email-using-templates-in-asp-net-core-applications/ Anyway, I created my email template using an…
dave317
  • 754
  • 2
  • 12
  • 30
1
vote
0 answers

How to correctly set the sort mode of a query with Bodybuilder?

I've picked up a project that uses Bodybuilder.js for queries to ELK and I am struggling to figure out how to format the query with Bodybuilder. I should note that I've tested this same query in other languages and it worked fine. As I had written…
1
vote
1 answer

Elasticsearch query including documents it should exclude and vice versa

IMPORTANT EDIT: The logic described below appears to be all correct. The root of my issue was actually being caused by the utility we used to push new data to the ES database, not with the query itself. I have accepted the answer that says that the…
Nick Byrd
  • 13
  • 3
1
vote
1 answer

bodybuilder generating query must should

TOPIC: tool: https://github.com/danpaz/bodybuilder An elasticsearch query body builder. Easily build complex queries for elasticsearch with a simple, predictable api. Does someone know how to make such a query using bodybuilder js? "query": { …
Kibo_007
  • 171
  • 3
  • 10
1
vote
2 answers

Bodybuilder js: Bucket Filter Aggregation

I would like to make buckets based of keyword-occurences in a field. I checked elasticsearch documentation and found Filters Aggregation should be a good…
Phil
  • 325
  • 1
  • 2
  • 7
0
votes
1 answer

Elasticsearch - how do i add `boost` to `constant_score` in bodybuilder?

I have the following bodybuilder query :- bodybuilder() .orQuery('match_all', {}) .orQuery('constant_score', null , (qr) => { return qr.filter('range', 'stock_sum', {gte: 1}) }) .build() Which basically…
Alexander Solonik
  • 9,838
  • 18
  • 76
  • 174
0
votes
1 answer

Axios request to Opensearch/Elasticsearch

Currently able to GET and POST to my collection but need the ability for more complicated queries, I am using bodybuilder to structure the request and axios as my client. However using POST doesn't return my specified results instead just the first…
0
votes
1 answer

Elasticsearch - Finding all entities with a nested id

I am trying to query a nested item but I am not sure how to formulate the query especially using javascript bodybuilder. Below is the mapping I am trying to get all the active items (isActive: true) that have the "anomaly" id. I am not sure how to…
Linkx_lair
  • 569
  • 1
  • 9
  • 21
0
votes
1 answer

BodyBuilder.js Query any of array

I'm creating an Elastic Search query that queries on two fields using BodyBuilder.js. One side of the query is string matching to the event type, the other takes in an array of strings and is satisfied if any match. Query(type) &&…
Marcus
  • 9,032
  • 11
  • 45
  • 84
0
votes
1 answer

Convert dot-notation JSON into elastic search deeply nested query JSON, with bodybuilder.js?

If I have a flat data structure which uses dot notation to denote depth. It looks like so: { "key1": "name1", "key2.subKey.finalKey": "name2" } I'm using this to create my query: let query = _.reduce(jsonQuery, (queryBody, queryValue,…
AncientSwordRage
  • 7,086
  • 19
  • 90
  • 173
0
votes
2 answers

adding filters dynamically to DSL query body generated using bodybuilder.js

The server gets an array of query terms from a frontend ajax call: req.query.filterTerms=['black', 'white', 'green'] I need to chain each ofthese filters to the bodybuilder query which is: var body=bodybuilder() .query('match', 'searchable',…
Zee
  • 13
  • 7