Skip to content

Nested Query Format #130

@L-Luciano

Description

@L-Luciano

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions