{"id":24468527,"url":"https://github.com/plotlabs/esgetfamily-node","last_synced_at":"2025-04-13T10:22:15.245Z","repository":{"id":57227568,"uuid":"130975103","full_name":"plotlabs/esgetfamily-node","owner":"plotlabs","description":"Get parent and children documents from Elasticsearch using a single query.","archived":false,"fork":false,"pushed_at":"2018-04-28T08:29:36.000Z","size":26,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T12:56:13.233Z","etag":null,"topics":["elasticsearch","nodejs","npm-package"],"latest_commit_sha":null,"homepage":"https://www.plotlabs.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plotlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-25T08:29:54.000Z","updated_at":"2025-02-06T14:19:18.000Z","dependencies_parsed_at":"2022-09-12T17:00:32.560Z","dependency_job_id":null,"html_url":"https://github.com/plotlabs/esgetfamily-node","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotlabs%2Fesgetfamily-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotlabs%2Fesgetfamily-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotlabs%2Fesgetfamily-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotlabs%2Fesgetfamily-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plotlabs","download_url":"https://codeload.github.com/plotlabs/esgetfamily-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248696232,"owners_count":21147093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elasticsearch","nodejs","npm-package"],"created_at":"2025-01-21T07:11:57.553Z","updated_at":"2025-04-13T10:22:15.222Z","avatar_url":"https://github.com/plotlabs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elasticsearch: Get Family - Node.js\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/plotlabs/esgetfamily-node/blob/master/LICENSE.txt) [![Build Status](https://travis-ci.org/plotlabs/esgetfamily-node.svg?branch=master)](https://travis-ci.org/plotlabs/esgetfamily-node) [![CodeFactor](https://www.codefactor.io/repository/github/plotlabs/esgetfamily-node/badge)](https://www.codefactor.io/repository/github/plotlabs/esgetfamily-node) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://www.plotlabs.io/) [![npm](https://img.shields.io/npm/v/esgetfamily.svg)](https://www.npmjs.com/package/esgetfamily)\n\nThe following library helps you get a unified result with parents having result of children in a **single result** with scroll and custom query.\n\n# Installation\n\n```console\nnpm install esgetfamily --save\nnpm install esgetfamily\n```\n\n## Using in node.js\n\n```js\nvar esgetfamily = require('esgetfamily');\nesgetfamily(\n  'http://localhost:9200',\n  {\n    index: 'es-getfamilytest',\n    parent_type: 'parent',\n    child_type: 'child'\n  },\n  [\n    {\n      _index: 'es-getfamilytest',\n      _type: 'parent',\n      _id: '1',\n      _score: 1,\n      _source: {\n        id: 1,\n        no_employee: 23,\n        company: 'Plotlabs'\n      }\n    }\n  ],\n  [\n    {\n      match: {\n        employee_name: 'employee 1'\n      }\n    }\n  ],\n  function(error, result) {\n    // Do something here.\n  }\n);\n```\n\n## Arguments\n\nThe function takes following arguments and in the following order\n\n```js\nesgetfamily(\n  \u003c URL \u003e,\n  \u003c connection parameters\u003e,\n  \u003c data \u003e,\n  \u003c filter \u003e,\n  function(error, result){\n      // Do something here.\n  }\n);\n```\n\n* **URL**: Mention the URL of either localhost or remote server\n* **connection parameters**: The argument has three parts `{ index: \"name of the index\", parent_type: \"name of the parent type\", children_type: \"name of the children type\" }`\n* **data**: pass any data array of parent object/objects. '\\_id' in each object is essential for it to parse it's child\n* **filter**: you can pass any valid query object for eg. `[{match: { \"employee_name\":\"employee 1\" }}]`\n* **callback**: simple callback function with error as first argument\n\n## Result\n\nThe result are in the form:\n\n```json\n[\n  {\n    \"_index\": \"es-getfamilytest\",\n    \"_type\": \"parent\",\n    \"_id\": \"1\",\n    \"_score\": 1,\n    \"_source\": { \"id\": 1, \"no_employee\": 23, \"company\": \"Plotlabs\" },\n    \"children\": [\n      {\n        \"_index\": \"es-getfamilytest\",\n        \"_type\": \"child\",\n        \"_id\": \"1\",\n        \"_score\": 1,\n        \"_routing\": \"1\",\n        \"_parent\": \"1\",\n        \"_source\": { \"id\": 1, \"name\": \"employee1\" }\n      }\n    ]\n  }\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotlabs%2Fesgetfamily-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplotlabs%2Fesgetfamily-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotlabs%2Fesgetfamily-node/lists"}