Open L-Luciano opened 4 years ago
Mappings : skills : type nested
Filter : filter[where][and][0][skills.name]=BizTalk 2010&filter[where][and][0][skills.xp][gte]=15
2 nested will be create whereas I want 1 nested with 2 query.
Partial solution for range example:
// Additional handling for nested Objects if (isNestedKey && !(inserted = this.insertNestedQuery(nestedSuperKey, rangeQuery, queryPath))) { rangeQuery = { nested: { path: nestedSuperKey, score_mode: 'max', query: rangeQuery } }; } if (!inserted) { if (root) { queryPath.bool.must.push(rangeQuery); } else { queryPath.push(rangeQuery); } }
function insertNestedQuery(nestedSuperKey, query, queryPath) { const alreadyQueryNested = queryPath.filter(query => { if (query.nested) { return query.nested.path == nestedSuperKey; } return false; }); if (alreadyQueryNested) { alreadyQueryNested[0].nested.query.bool.must.push(query); return true; } return false; }
Mappings : skills : type nested
Filter : filter[where][and][0][skills.name]=BizTalk 2010&filter[where][and][0][skills.xp][gte]=15
2 nested will be create whereas I want 1 nested with 2 query.
Partial solution for range example: