- About
- Browser Builds
- Quick Start
- API Conventions
- Configuration
- SSL and Authentication
- Extending
- Extensions
- setup logging
- Contributing
- 7.6 API
bulkclearScrollcountcreatedeletedeleteByQuerydeleteByQueryRethrottledeleteScriptexistsexistsSourceexplainfieldCapsgetgetScriptgetSourceindexinfomgetmsearchmsearchTemplatemtermvectorspingputScriptrankEvalreindexreindexRethrottlerenderSearchTemplatescriptsPainlessExecutescrollsearchsearchShardssearchTemplatetermvectorsupdateupdateByQueryupdateByQueryRethrottlecat.aliasescat.allocationcat.countcat.fielddatacat.healthcat.helpcat.indicescat.mastercat.nodeattrscat.nodescat.pendingTaskscat.pluginscat.recoverycat.repositoriescat.segmentscat.shardscat.snapshotscat.taskscat.templatescat.threadPoolcluster.allocationExplaincluster.getSettingscluster.healthcluster.pendingTaskscluster.putSettingscluster.remoteInfocluster.reroutecluster.statecluster.statsindices.analyzeindices.clearCacheindices.cloneindices.closeindices.createindices.deleteindices.deleteAliasindices.deleteTemplateindices.existsindices.existsAliasindices.existsTemplateindices.existsTypeindices.flushindices.flushSyncedindices.forcemergeindices.getindices.getAliasindices.getFieldMappingindices.getMappingindices.getSettingsindices.getTemplateindices.getUpgradeindices.openindices.putAliasindices.putMappingindices.putSettingsindices.putTemplateindices.recoveryindices.refreshindices.rolloverindices.segmentsindices.shardStoresindices.shrinkindices.splitindices.statsindices.updateAliasesindices.upgradeindices.validateQueryingest.deletePipelineingest.getPipelineingest.processorGrokingest.putPipelineingest.simulatenodes.hotThreadsnodes.infonodes.reloadSecureSettingsnodes.statsnodes.usagesnapshot.createsnapshot.createRepositorysnapshot.deletesnapshot.deleteRepositorysnapshot.getsnapshot.getRepositorysnapshot.restoresnapshot.statussnapshot.verifyRepositorytasks.canceltasks.gettasks.list
- 7.5 API
bulkclearScrollcountcreatedeletedeleteByQuerydeleteByQueryRethrottledeleteScriptexistsexistsSourceexplainfieldCapsgetgetScriptgetSourceindexinfomgetmsearchmsearchTemplatemtermvectorspingputScriptrankEvalreindexreindexRethrottlerenderSearchTemplatescriptsPainlessExecutescrollsearchsearchShardssearchTemplatetermvectorsupdateupdateByQueryupdateByQueryRethrottlecat.aliasescat.allocationcat.countcat.fielddatacat.healthcat.helpcat.indicescat.mastercat.nodeattrscat.nodescat.pendingTaskscat.pluginscat.recoverycat.repositoriescat.segmentscat.shardscat.snapshotscat.taskscat.templatescat.threadPoolcluster.allocationExplaincluster.getSettingscluster.healthcluster.pendingTaskscluster.putSettingscluster.remoteInfocluster.reroutecluster.statecluster.statsindices.analyzeindices.clearCacheindices.cloneindices.closeindices.createindices.deleteindices.deleteAliasindices.deleteTemplateindices.existsindices.existsAliasindices.existsTemplateindices.existsTypeindices.flushindices.flushSyncedindices.forcemergeindices.getindices.getAliasindices.getFieldMappingindices.getMappingindices.getSettingsindices.getTemplateindices.getUpgradeindices.openindices.putAliasindices.putMappingindices.putSettingsindices.putTemplateindices.recoveryindices.refreshindices.rolloverindices.segmentsindices.shardStoresindices.shrinkindices.splitindices.statsindices.updateAliasesindices.upgradeindices.validateQueryingest.deletePipelineingest.getPipelineingest.processorGrokingest.putPipelineingest.simulatenodes.hotThreadsnodes.infonodes.reloadSecureSettingsnodes.statsnodes.usagesnapshot.createsnapshot.createRepositorysnapshot.deletesnapshot.deleteRepositorysnapshot.getsnapshot.getRepositorysnapshot.restoresnapshot.statussnapshot.verifyRepositorytasks.canceltasks.gettasks.list
- 7.4 API
bulkclearScrollcountcreatedeletedeleteByQuerydeleteByQueryRethrottledeleteScriptexistsexistsSourceexplainfieldCapsgetgetScriptgetSourceindexinfomgetmsearchmsearchTemplatemtermvectorspingputScriptrankEvalreindexreindexRethrottlerenderSearchTemplatescriptsPainlessExecutescrollsearchsearchShardssearchTemplatetermvectorsupdateupdateByQueryupdateByQueryRethrottlecat.aliasescat.allocationcat.countcat.fielddatacat.healthcat.helpcat.indicescat.mastercat.nodeattrscat.nodescat.pendingTaskscat.pluginscat.recoverycat.repositoriescat.segmentscat.shardscat.snapshotscat.taskscat.templatescat.threadPoolcluster.allocationExplaincluster.getSettingscluster.healthcluster.pendingTaskscluster.putSettingscluster.remoteInfocluster.reroutecluster.statecluster.statsindices.analyzeindices.clearCacheindices.cloneindices.closeindices.createindices.deleteindices.deleteAliasindices.deleteTemplateindices.existsindices.existsAliasindices.existsTemplateindices.existsTypeindices.flushindices.flushSyncedindices.forcemergeindices.getindices.getAliasindices.getFieldMappingindices.getMappingindices.getSettingsindices.getTemplateindices.getUpgradeindices.openindices.putAliasindices.putMappingindices.putSettingsindices.putTemplateindices.recoveryindices.refreshindices.rolloverindices.segmentsindices.shardStoresindices.shrinkindices.splitindices.statsindices.updateAliasesindices.upgradeindices.validateQueryingest.deletePipelineingest.getPipelineingest.processorGrokingest.putPipelineingest.simulatenodes.hotThreadsnodes.infonodes.reloadSecureSettingsnodes.statsnodes.usagesnapshot.createsnapshot.createRepositorysnapshot.deletesnapshot.deleteRepositorysnapshot.getsnapshot.getRepositorysnapshot.restoresnapshot.statussnapshot.verifyRepositorytasks.canceltasks.gettasks.list
- 7.3 API
bulkclearScrollcountcreatedeletedeleteByQuerydeleteByQueryRethrottledeleteScriptexistsexistsSourceexplainfieldCapsgetgetScriptgetSourceindexinfomgetmsearchmsearchTemplatemtermvectorspingputScriptrankEvalreindexreindexRethrottlerenderSearchTemplatescriptsPainlessExecutescrollsearchsearchShardssearchTemplatetermvectorsupdateupdateByQueryupdateByQueryRethrottlecat.aliasescat.allocationcat.countcat.fielddatacat.healthcat.helpcat.indicescat.mastercat.nodeattrscat.nodescat.pendingTaskscat.pluginscat.recoverycat.repositoriescat.segmentscat.shardscat.snapshotscat.taskscat.templatescat.threadPoolcluster.allocationExplaincluster.getSettingscluster.healthcluster.pendingTaskscluster.putSettingscluster.remoteInfocluster.reroutecluster.statecluster.statsindices.analyzeindices.clearCacheindices.closeindices.createindices.deleteindices.deleteAliasindices.deleteTemplateindices.existsindices.existsAliasindices.existsTemplateindices.existsTypeindices.flushindices.flushSyncedindices.forcemergeindices.getindices.getAliasindices.getFieldMappingindices.getMappingindices.getSettingsindices.getTemplateindices.getUpgradeindices.openindices.putAliasindices.putMappingindices.putSettingsindices.putTemplateindices.recoveryindices.refreshindices.rolloverindices.segmentsindices.shardStoresindices.shrinkindices.splitindices.statsindices.updateAliasesindices.upgradeindices.validateQueryingest.deletePipelineingest.getPipelineingest.processorGrokingest.putPipelineingest.simulatenodes.hotThreadsnodes.infonodes.reloadSecureSettingsnodes.statsnodes.usagesnapshot.createsnapshot.createRepositorysnapshot.deletesnapshot.deleteRepositorysnapshot.getsnapshot.getRepositorysnapshot.restoresnapshot.statussnapshot.verifyRepositorytasks.canceltasks.gettasks.list
- 7.2 API
bulkclearScrollcountcreatedeletedeleteByQuerydeleteByQueryRethrottledeleteScriptexistsexistsSourceexplainfieldCapsgetgetScriptgetSourceindexinfomgetmsearchmsearchTemplatemtermvectorspingputScriptrankEvalreindexreindexRethrottlerenderSearchTemplatescriptsPainlessContextscriptsPainlessExecutescrollsearchsearchShardssearchTemplatetermvectorsupdateupdateByQueryupdateByQueryRethrottlecat.aliasescat.allocationcat.countcat.fielddatacat.healthcat.helpcat.indicescat.mastercat.nodeattrscat.nodescat.pendingTaskscat.pluginscat.recoverycat.repositoriescat.segmentscat.shardscat.snapshotscat.taskscat.templatescat.threadPoolcluster.allocationExplaincluster.getSettingscluster.healthcluster.pendingTaskscluster.putSettingscluster.remoteInfocluster.reroutecluster.statecluster.statsindices.analyzeindices.clearCacheindices.closeindices.createindices.deleteindices.deleteAliasindices.deleteTemplateindices.existsindices.existsAliasindices.existsTemplateindices.existsTypeindices.flushindices.flushSyncedindices.forcemergeindices.getindices.getAliasindices.getFieldMappingindices.getMappingindices.getSettingsindices.getTemplateindices.getUpgradeindices.openindices.putAliasindices.putMappingindices.putSettingsindices.putTemplateindices.recoveryindices.refreshindices.rolloverindices.segmentsindices.shardStoresindices.shrinkindices.splitindices.statsindices.updateAliasesindices.upgradeindices.validateQueryingest.deletePipelineingest.getPipelineingest.processorGrokingest.putPipelineingest.simulatenodes.hotThreadsnodes.infonodes.reloadSecureSettingsnodes.statsnodes.usagesnapshot.createsnapshot.createRepositorysnapshot.deletesnapshot.deleteRepositorysnapshot.getsnapshot.getRepositorysnapshot.restoresnapshot.statussnapshot.verifyRepositorytasks.canceltasks.gettasks.list
- 7.1 API
bulkclearScrollcountcreatedeletedeleteByQuerydeleteByQueryRethrottledeleteScriptexistsexistsSourceexplainfieldCapsgetgetScriptgetSourceindexinfomgetmsearchmsearchTemplatemtermvectorspingputScriptrankEvalreindexreindexRethrottlerenderSearchTemplatescriptsPainlessExecutescrollsearchsearchShardssearchTemplatetermvectorsupdateupdateByQueryupdateByQueryRethrottlecat.aliasescat.allocationcat.countcat.fielddatacat.healthcat.helpcat.indicescat.mastercat.nodeattrscat.nodescat.pendingTaskscat.pluginscat.recoverycat.repositoriescat.segmentscat.shardscat.snapshotscat.taskscat.templatescat.threadPoolcluster.allocationExplaincluster.getSettingscluster.healthcluster.pendingTaskscluster.putSettingscluster.remoteInfocluster.reroutecluster.statecluster.statsindices.analyzeindices.clearCacheindices.closeindices.createindices.deleteindices.deleteAliasindices.deleteTemplateindices.existsindices.existsAliasindices.existsTemplateindices.existsTypeindices.flushindices.flushSyncedindices.forcemergeindices.getindices.getAliasindices.getFieldMappingindices.getMappingindices.getSettingsindices.getTemplateindices.getUpgradeindices.openindices.putAliasindices.putMappingindices.putSettingsindices.putTemplateindices.recoveryindices.refreshindices.rolloverindices.segmentsindices.shardStoresindices.shrinkindices.splitindices.statsindices.updateAliasesindices.upgradeindices.validateQueryingest.deletePipelineingest.getPipelineingest.processorGrokingest.putPipelineingest.simulatenodes.hotThreadsnodes.infonodes.reloadSecureSettingsnodes.statsnodes.usagesnapshot.createsnapshot.createRepositorysnapshot.deletesnapshot.deleteRepositorysnapshot.getsnapshot.getRepositorysnapshot.restoresnapshot.statussnapshot.verifyRepositorytasks.canceltasks.gettasks.list
- 7.0 API
bulkclearScrollcountcreatedeletedeleteByQuerydeleteByQueryRethrottledeleteScriptexistsexistsSourceexplainfieldCapsgetgetScriptgetSourceindexinfomgetmsearchmsearchTemplatemtermvectorspingputScriptrankEvalreindexreindexRethrottlerenderSearchTemplatescriptsPainlessExecutescrollsearchsearchShardssearchTemplatetermvectorsupdateupdateByQueryupdateByQueryRethrottlecat.aliasescat.allocationcat.countcat.fielddatacat.healthcat.helpcat.indicescat.mastercat.nodeattrscat.nodescat.pendingTaskscat.pluginscat.recoverycat.repositoriescat.segmentscat.shardscat.snapshotscat.taskscat.templatescat.threadPoolcluster.allocationExplaincluster.getSettingscluster.healthcluster.pendingTaskscluster.putSettingscluster.remoteInfocluster.reroutecluster.statecluster.statsindices.analyzeindices.clearCacheindices.closeindices.createindices.deleteindices.deleteAliasindices.deleteTemplateindices.existsindices.existsAliasindices.existsTemplateindices.existsTypeindices.flushindices.flushSyncedindices.forcemergeindices.getindices.getAliasindices.getFieldMappingindices.getMappingindices.getSettingsindices.getTemplateindices.getUpgradeindices.openindices.putAliasindices.putMappingindices.putSettingsindices.putTemplateindices.recoveryindices.refreshindices.rolloverindices.segmentsindices.shardStoresindices.shrinkindices.splitindices.statsindices.updateAliasesindices.upgradeindices.validateQueryingest.deletePipelineingest.getPipelineingest.processorGrokingest.putPipelineingest.simulatenodes.hotThreadsnodes.infonodes.reloadSecureSettingsnodes.statsnodes.usagesnapshot.createsnapshot.createRepositorysnapshot.deletesnapshot.deleteRepositorysnapshot.getsnapshot.getRepositorysnapshot.restoresnapshot.statussnapshot.verifyRepositorytasks.canceltasks.gettasks.list
- 6.8 API
bulkclearScrollcountcreatedeletedeleteByQuerydeleteByQueryRethrottledeleteScriptexistsexistsSourceexplainfieldCapsgetgetScriptgetSourceindexinfomgetmsearchmsearchTemplatemtermvectorspingputScriptrankEvalreindexreindexRethrottlerenderSearchTemplatescriptsPainlessExecutescrollsearchsearchShardssearchTemplatetermvectorsupdateupdateByQueryupdateByQueryRethrottlecat.aliasescat.allocationcat.countcat.fielddatacat.healthcat.helpcat.indicescat.mastercat.nodeattrscat.nodescat.pendingTaskscat.pluginscat.recoverycat.repositoriescat.segmentscat.shardscat.snapshotscat.taskscat.templatescat.threadPoolcluster.allocationExplaincluster.getSettingscluster.healthcluster.pendingTaskscluster.putSettingscluster.remoteInfocluster.reroutecluster.statecluster.statsindices.analyzeindices.clearCacheindices.closeindices.createindices.deleteindices.deleteAliasindices.deleteTemplateindices.existsindices.existsAliasindices.existsTemplateindices.existsTypeindices.flushindices.flushSyncedindices.forcemergeindices.getindices.getAliasindices.getFieldMappingindices.getMappingindices.getSettingsindices.getTemplateindices.getUpgradeindices.openindices.putAliasindices.putMappingindices.putSettingsindices.putTemplateindices.recoveryindices.refreshindices.rolloverindices.segmentsindices.shardStoresindices.shrinkindices.splitindices.statsindices.updateAliasesindices.upgradeindices.validateQueryingest.deletePipelineingest.getPipelineingest.processorGrokingest.putPipelineingest.simulatenodes.hotThreadsnodes.infonodes.reloadSecureSettingsnodes.statsnodes.usagesnapshot.createsnapshot.createRepositorysnapshot.deletesnapshot.deleteRepositorysnapshot.getsnapshot.getRepositorysnapshot.restoresnapshot.statussnapshot.verifyRepositorytasks.canceltasks.gettasks.list
- 5.6 API
bulkclearScrollcountcountPercolatecreatedeletedeleteByQuerydeleteScriptdeleteTemplateexistsexistsSourceexplainfieldCapsfieldStatsgetgetScriptgetSourcegetTemplateindexinfomgetmpercolatemsearchmsearchTemplatemtermvectorspercolatepingputScriptputTemplatereindexreindexRethrottlerenderSearchTemplatescrollsearchsearchShardssearchTemplatesuggesttermvectorsupdateupdateByQuerycat.aliasescat.allocationcat.countcat.fielddatacat.healthcat.helpcat.indicescat.mastercat.nodeattrscat.nodescat.pendingTaskscat.pluginscat.recoverycat.repositoriescat.segmentscat.shardscat.snapshotscat.taskscat.templatescat.threadPoolcluster.allocationExplaincluster.getSettingscluster.healthcluster.pendingTaskscluster.putSettingscluster.remoteInfocluster.reroutecluster.statecluster.statsindices.analyzeindices.clearCacheindices.closeindices.createindices.deleteindices.deleteAliasindices.deleteTemplateindices.existsindices.existsAliasindices.existsTemplateindices.existsTypeindices.flushindices.flushSyncedindices.forcemergeindices.getindices.getAliasindices.getFieldMappingindices.getMappingindices.getSettingsindices.getTemplateindices.getUpgradeindices.openindices.putAliasindices.putMappingindices.putSettingsindices.putTemplateindices.recoveryindices.refreshindices.rolloverindices.segmentsindices.shardStoresindices.shrinkindices.statsindices.updateAliasesindices.upgradeindices.validateQueryingest.deletePipelineingest.getPipelineingest.processorGrokingest.putPipelineingest.simulatenodes.hotThreadsnodes.infonodes.statssnapshot.createsnapshot.createRepositorysnapshot.deletesnapshot.deleteRepositorysnapshot.getsnapshot.getRepositorysnapshot.restoresnapshot.statussnapshot.verifyRepositorytasks.canceltasks.gettasks.list
- Changelog
- Host
- Transport
- Errors
- API Param Types
IMPORTANT: elasticsearch.js has been replaced by the new Elasticsearch JavaScript client. We strongly advise you to migrate to the new client. To learn more, see the migration guide.
Examples
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Examples
editUsing your application to proxy/filter elasticsearch requests can sometimes be a good idea. Use this configuration to always send requests to https://my-site.com/elasticsearch/{{request url}} rather than directly to elasticsearch.
var client = new elasticsearch.Client({ host: { protocol: 'https', host: 'my-site.com', port: 80, path: '/elasticsearch/' } })
Use custom keys/vals to add special properties to the hosts, that are used by the selector.
var client = new elasticsearch.Client({ hosts: [ { protocol: 'https', host: 'box1.server.org', port: 56394, // these custom values are used below by the selector country: 'EU', weight: 10 }, { protocol: 'https', host: 'box2.server.org', port: 56394, // these custom values are used below by the selector country: 'US', weight: 50 } ], selector: function (nodes) { var myCountry = process.env.COUNTRY; // first try to find a node that is in the same country var selection = _.find(nodes, function (node) { return node.host.country === myCountry; }); if (!selection) { // choose the node with the lightest weight. selection = _(nodes).sortBy(function (node) { return node.host.weight; }).first(); } return selection; } });
Was this helpful?
Thank you for your feedback.