Class: ElasticSearch

SuperMap.ElasticSearch

ElasticSearch服务类。

new SuperMap.ElasticSearch(url, options)

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

ElasticSearch服务地址。

options Object

参数。

Name Type Default Description
change function 可选

服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。

openGeoFence boolean false 可选

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

outOfGeoFence function 可选

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

geoFence Object 可选

地理围栏。

Members

changefunction

服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。

Deprecated
  • Yes

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 101

批量操作API,允许执行多个索引/删除操作。 参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">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 113

通过指定scroll参数进行查询来清除已经创建的scroll请求。 参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html">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 125

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

Name Type Description
params Object

参数。

callback function

回调函数。

count(params, callback)

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

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

Name Type Description
params Object

参数。

callback function

回调函数。

delete(params, callback)

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

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

Name Type Description
params Object

参数。

callback function

回调函数。

delete(params, callback)

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

根据其ID从特定索引中删除键入的JSON文档。 参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html">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 173

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

Name Type Description
params Object

参数。

callback function

回调函数。

deleteTemplate(params, callback)

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

根据其ID删除模板。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html">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 197

检查给定文档是否存在。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">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 209

检查资源是否存在。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">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 222

提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html">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 234

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

从索引获取一个基于其id的类型的JSON文档。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">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 259

获取脚本。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html">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 271

通过索引,类型和ID获取文档的源。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">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 283

获取模板。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html">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 295

在索引中存储一个键入的JSON文档,使其可搜索。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index\_.html">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 307

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

Name Type Description
params Object

参数。

callback function

回调函数。

mget(params, callback)

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

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

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

Name Type Description
params Object

参数。

callback function

请求返回的回调函数。也可以使用then表达式获取返回结果。 回调参数:error,response。结果存储在response.responses中

msearchTemplate(params, callback)

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

在同一请求中执行多个搜索模板请求。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html">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 366

多termvectors API允许一次获得多个termvectors。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html">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 378

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

Name Type Description
params Object

参数。

callback function

回调函数。

putScript(params, callback)

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

添加脚本。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html">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 402

添加模板。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html">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 414

重新索引。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html">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 426

重新索引。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html">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 438

搜索模板。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html">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 450

在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html">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 462

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

Name Type Description
params Object

参数。

callback function

请求返回的回调函数。也可以使用then表达式获取返回结果。 回调参数:error,response,结果存储在response.responses中

searchShards(params, callback)

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

返回要执行搜索请求的索引和分片。 参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html">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 496

搜索模板。 参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html">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 91

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

Name Type Description
geoFence SuperMap.Geometry

地理围栏。

suggest(params, callback)

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

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

返回有关特定文档字段中的术语的信息和统计信息。 参数设置参考 href="http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors">www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}
更多信息参考 href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html">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 532

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

Name Type Description
params Object

参数。

callback function

回调函数。

update(params, callback)

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

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

Name Type Description
params Object

参数。

callback function

回调函数。