{"id":16681430,"url":"https://github.com/printercu/elastics","last_synced_at":"2025-07-07T20:03:56.650Z","repository":{"id":6498561,"uuid":"7739045","full_name":"printercu/elastics","owner":"printercu","description":"simple elasticsearch client for node.js","archived":false,"fork":false,"pushed_at":"2014-11-05T11:12:36.000Z","size":196,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-11T10:18:37.298Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/printercu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-21T19:44:57.000Z","updated_at":"2024-09-08T22:26:49.000Z","dependencies_parsed_at":"2022-07-09T07:01:18.133Z","dependency_job_id":null,"html_url":"https://github.com/printercu/elastics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/printercu/elastics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/printercu%2Felastics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/printercu%2Felastics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/printercu%2Felastics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/printercu%2Felastics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/printercu","download_url":"https://codeload.github.com/printercu/elastics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/printercu%2Felastics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260823364,"owners_count":23068299,"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":[],"created_at":"2024-10-12T14:04:11.387Z","updated_at":"2025-07-07T20:03:56.630Z","avatar_url":"https://github.com/printercu.png","language":"CoffeeScript","readme":"# elastics\nSimple \u0026 handy client for elasticsearch. It's just a wrapper around\n`http.request` with shortcuts for elasticsearch.\n\nIt implements all available functionality \u0026 even upcoming.\n\nBe careful while using settings for default type \u0026 index: they are client's\ninstance variables. So if you are going to have one client in an application\nyou'd better set them explicitly in each call. JS is so _asynchronous..._\n\n_Looking for easy indices and mappings management with zero-downtime migrations?\nCheck out [ruby version](https://github.com/printercu/elastics-rb)._\n\n## usage\n\n```coffee\nElastics = require 'elastics'\nes = new Elastics\n  host:  hostname # default 'localhost'\n  port:  port     # default 9200\n  index: index    # default null\n  type:  type     # default null\n```\n\nThis params are stored in `es.defaults`. You can change them with:\n\n- `setIndex(index, [type = null])`\n- `setType(type)`\n\nFor the first time I've made all the methods adaptive to arguments. But then\nthere have appeared to much significant arguments so I gave it up.\n\nSo all the methods take two args: object with parameters \u0026 callback.\nFor now you can omit callback but not params.\n\n### params fields:\n- `method` - http request method\n- `index`\n- `type`\n- `path` - last part for url\n- `id` - same as `path` but with higher priority\n- `query` - query string for url. you can set routing params here\n- `data` - request body\n\nYou can omit fields stored in `defaults`\n\n### lowest level\n`request(params, [callback])`\n\n### request-type level\n`get()`, `put()`, `post()`, `delete()` - just set the method\n\n### highest level\n- `putMapping()` - put with `path = '_mapping'`\n- `search()` - post with `path = '_search'`\n- `index()` - if `id` field is set then `put` else `post`\n\n## few examples\n```coffee\nes.setType()\n# index:null, type: null\n\nes.get {}\n# GET http://host::port/\n\nes.post index: 'index'\n# POST http://host::port/index\n\nes.setIndex 'other_index', 'type'\nmapping = type:\n  fields:\n    field_one: type: 'string'\nes.putMapping data: mapping\n# PUT http://host::port/other_index/type/_mapping\n# body is json of mapping\n\nes.get index: 'one', type: 'two', id: 'three'\n# GET http://host::port/one/two/three\n```\n\nsee tests\n\n## LICENSE\nBSD\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprintercu%2Felastics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprintercu%2Felastics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprintercu%2Felastics/lists"}