Class: ElasticSearch

ElasticSearch

ElasticSearch服务类。

new SuperMap.ElasticSearch(url, options)

common/thirdparty/elasticsearch/ElasticSearch.js, line 4
Name Type Description
url string

ElasticSearch服务地址。

options Object

可选参数。如:
change - {function} 服务器返回数据后执行的函数。
openGeoFence - {boolean} 是否开启地理围栏验证,默认为不开启。
outOfGeoFence - {function} 数据超出地理围栏后执行的函数。
geoFence - {Object} 地理围栏。

Members

changefunction

服务器返回数据后执行的函数

clientObject

client ES客户端

eventListenersObject

听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听, 相当于调用 SuperMap.Events.on(eventListeners)。

事件

geoFenceObject

地理围栏

Example
{
   radius: 1000,//单位是m
   center: [104.40, 30.43],
   unit: 'meter|degree'
 }

openGeoFenceboolean

是否开启地理围栏验证,默认为不开启。

outOfGeoFencefunction

数据超出地理围栏后执行的函数

urlstring

ElasticSearch服务地址

Methods

bulk(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 102

批量操作API,允许执行多个索引/删除操作。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html

Name Type Description
params Object

参数。

callback function

回调函数。

clearScroll(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 114

通过指定scroll参数进行查询来清除已经创建的scroll请求。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html

Name Type Description
params Object

参数。

callback function

回调函数。

count(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 138

在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且id已经存在的文档将发生错误。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html

Name Type Description
params Object

参数。

callback function

回调函数。

count(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 126

获取集群、索引、类型或查询的文档个数。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html

Name Type Description
params Object

参数。

callback function

回调函数。

delete(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 174

根据其ID删除脚本。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html

Name Type Description
params Object

参数。

callback function

回调函数。

delete(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 150

根据其ID从特定索引中删除键入的JSON文档。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html

Name Type Description
params Object

参数。

callback function

回调函数。

delete(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 162

根据其ID从特定索引中删除键入的JSON文档。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

Name Type Description
params Object

参数。

callback function

回调函数。

deleteTemplate(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 186

根据其ID删除模板。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

Name Type Description
params Object

参数。

callback function

回调函数。

exists(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 198

检查给定文档是否存在。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html

Name Type Description
params Object

参数。

callback function

回调函数。

existsSource(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 210

检查资源是否存在。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html

Name Type Description
params Object

参数。

callback function

回调函数。

explain(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 223

提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html

Name Type Description
params Object

参数。

callback function

回调函数。

fieldCaps(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 235

允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html

Name Type Description
params Object

参数。

callback function

回调函数。

get(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 248

从索引获取一个基于其id的类型的JSON文档。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html

Name Type Description
params Object

参数。

callback function

回调函数。

getScript(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 260

获取脚本。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html

Name Type Description
params Object

参数。

callback function

回调函数。

getSource(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 272

通过索引,类型和ID获取文档的源。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html

Name Type Description
params Object

参数。

callback function

回调函数。

getTemplate(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 284

获取模板。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

Name Type Description
params Object

参数。

callback function

回调函数。

index(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 296

在索引中存储一个键入的JSON文档,使其可搜索。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html

Name Type Description
params Object

参数。

callback function

回调函数。

info(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 308

从当前集群获取基本信息。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info
更多信息参考 https://www.elastic.co/guide/index.html

Name Type Description
params Object

参数。

callback function

回调函数。

mget(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 320

根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html

Name Type Description
params Object

参数。

callback function

回调函数。

msearch(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 332

在同一请求中执行多个搜索请求。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html

Name Type Description
params Object

参数。

callback function

回调函数。

msearchTemplate(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 352

在同一请求中执行多个搜索模板请求。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

Name Type Description
params Object

参数。

callback function

回调函数。

mtermvectors(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 364

多termvectors API允许一次获得多个termvectors。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html

Name Type Description
params Object

参数。

callback function

回调函数。

ping(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 376

测试连接。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping
更多信息参考 https://www.elastic.co/guide/index.html

Name Type Description
params Object

参数。

callback function

回调函数。

putScript(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 388

添加脚本。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html

Name Type Description
params Object

参数。

callback function

回调函数。

putTemplate(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 400

添加模板。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

Name Type Description
params Object

参数。

callback function

回调函数。

reindex(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 412

重新索引。
参数设置参考 参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html

Name Type Description
params Object

参数。

callback function

回调函数。

reindexRessrottle(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 424

重新索引。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html

Name Type Description
params Object

参数。

callback function

回调函数。

renderSearchTemplate(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 436

搜索模板。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

Name Type Description
params Object

参数。

callback function

回调函数。

scroll(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 448

在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html

Name Type Description
params Object

参数。

callback function

回调函数。

common/thirdparty/elasticsearch/ElasticSearch.js, line 460

在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html

Name Type Description
params Object

参数。

callback function

回调函数。

searchShards(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 480

返回要执行搜索请求的索引和分片。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html

Name Type Description
params Object

参数。

callback function

回调函数。

searchTemplate(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 492

搜索模板。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html

Name Type Description
params Object

参数。

callback function

回调函数。

setGeoFence(geoFence)

common/thirdparty/elasticsearch/ElasticSearch.js, line 92

设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。

Name Type Description
geoFence SuperMap.Geometry

地理围栏。

suggest(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 504

该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html

Name Type Description
params Object

参数。

callback function

回调函数。

termvectors(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 516

返回有关特定文档字段中的术语的信息和统计信息。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html

Name Type Description
params Object

参数。

callback function

回调函数。

update(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 540

通过查询API来更新文档。
参数设置参考 参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html

Name Type Description
params Object

参数。

callback function

回调函数。

update(params, callback)

common/thirdparty/elasticsearch/ElasticSearch.js, line 528

更新文档的部分。
参数设置参考 https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update
更多信息参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html

Name Type Description
params Object

参数。

callback function

回调函数。