Elasticsearch Reference
  • Introduction
  • 入门
    • 基本概念
    • 安装
    • 探索集群
      • 集群健康
      • 获取所有索引库
      • 创建一个索引库
      • 索引文档创建与查询
      • 删除索引
    • 修改数据
      • 更新文档
      • 删除文档
      • 批量处理
    • 探索您的数据
      • 搜索API
      • 查询语言介绍
      • 执行搜索
      • 执行过滤
      • 执行聚合
    • 总结
  • Elasticsearch设置
    • 安装Elasticsearch
      • .zip或.tar.gz文件的安装方式
      • Debian软件包安装方式
      • RPM安装方式
      • Windows安装方式
      • Docker安装方式
    • 配置Elasticsearch
    • 重要的Elasticsearch配置
    • 安全配置
    • 启动前检查
      • 堆大小检查
      • 文件描述符检查
      • 内存锁定检查
      • 最大线程数检查
      • 最大虚拟内存检查
      • 最大map数检查
      • JVM检查
      • 串行收集使用检查
      • 系统调用过滤检查
      • OnError与OnOutOfMemroyError检查
      • G1GC检查
    • 重要的系统配置
      • 系统设置
      • 在jvm.options中设置JVM堆大小
      • 禁用swapping
      • 文件描述符
      • 虚拟内存
      • 线程数
    • Elasticsearch升级
      • 滚动升级
      • 全集群重启升级
      • 索引重建升级
    • Elasticsearch停机
  • 重大变更
    • 5.3重大变更
    • 5.2重大变更
      • 删除Shadow副本
    • 5.1重大变更
    • 5.0重大变更
      • 搜索与查询DSL变化
      • Mapping变化
      • Percolator变化
      • Suggester变化
      • Index API变化
      • Document API变化
      • Settings变化
      • Allocation变化
      • HTTP变化
      • REST API变化
      • CAT API变化
      • JAVA API变化
      • 安装包
      • 插件变化
      • 文件系统相关变化
      • 磁盘数据文件路径
      • Aggregation变化
      • 脚本相关变化
  • API约定
    • 多索引语法
    • 索引库名称的日期运算
    • 常用选项
    • URL-based访问控制
  • 文档API
    • 读写文档
    • Index API
    • Get API
    • Delete API
    • Delete By Query API
    • Update API
    • Update By Query API
    • Multi Get API
    • Bulk API
    • Reindex API
    • Term Vectors
    • Multi termvectors API
    • refresh
  • 搜索API
    • Search
    • URI Search
    • Request Body Search
      • Query
      • From / Size
      • Sort
      • Source filtering
      • Fields
      • Script Fields
      • Doc value Fields
      • Post filter
      • Highlighting
      • Rescoring
      • Search Type
      • Scroll
      • Preference
      • Explain
      • Version
      • Index Boost
      • min_score
      • Named Queries
      • Inner hits
      • Field Collapsing
      • Search After
    • Search Template
    • Multi Search Template
    • Search Shards API
    • Suggesters
      • Term suggester
      • Phrase Suggester
      • Completion Suggester
      • Context Suggester
    • Multi Search API
    • Count API
    • Validate API
    • Explain API
    • Profile API
      • Profiling Queries
      • Profiling Aggregations
      • Profiling Considerations
    • Percolator
    • Field stats API
  • 聚合
    • Metrics Aggregations
      • Avg Aggregation
      • Cardinality Aggregation
      • Extended Stats Aggregation
      • Geo Bounds Aggregation
      • Geo Centroid Aggregation
      • Max Aggregation
      • Min Aggregation
      • Percentiles Aggregation
      • Percentile Ranks Aggregation
      • Scripted Metric Aggregation
      • Stats Aggregation
      • Sum Aggregation
      • Top hits Aggregation
      • Value Count Aggregation
    • Bucket Aggregations
      • Adjacency Matrix Aggregation
      • Children Aggregation
      • Date Histogram Aggregation
      • Date Range Aggregation
      • Diversified Sampler Aggregation
      • Filter Aggregation
      • Filters Aggregation
      • Geo Distance Aggregation
      • GeoHash grid Aggregation
      • Global Aggregation
      • Histogram Aggregation
      • IP Range Aggregation
      • Missing Aggregation
      • Nested Aggregation
      • Range Aggregation
      • Reverse nested Aggregation
      • Sampler Aggregation
      • Significant Terms Aggregation
      • Terms Aggregation
    • Pipeline Aggregations
      • Avg Bucket Aggregation
      • Derivative Aggregation
      • Max Bucket Aggregation
      • Min Bucket Aggregation
      • Sum Bucket Aggregation
      • Stats Bucket Aggregation
      • Extended Stats Bucket Aggregation
      • Percentiles Bucket Aggregation
      • Moving Average Aggregation
      • Cumulative Sum Aggregation
      • Bucket Script Aggregation
      • Bucket Selector Aggregation
      • Serial Differencing Aggregation
    • Matrix Aggregations
      • Matrix Stats
    • Caching heavy aggregations
    • Returning only aggregation results
    • Aggregation Metadata
  • 索引库API
    • Create Index
    • Delete Index
    • Get Index
    • Indices Exists
    • Open / Close Index API
    • Shrink Index
    • Rollover Index
    • Put Mapping
    • Get Mapping
    • Get Field Mapping
    • Types Exists
    • Index Aliases
    • Update Indices Settings
    • Get Settings
    • Analyze
      • Explain Analyze
    • Index Templates
    • Shadow replica indices
      • Node level settings related to shadow replicas
    • Indices Stats
    • Indices Segments
    • Indices Recovery
    • Indices Shard Stores
    • Clear Cache
    • Flush
      • Synced Flush
    • Refresh
    • Force Merge
  • cat API
    • cat aliases
    • cat allocation
    • cat count
    • cat fielddata
    • cat health
    • cat indices
    • cat master
    • cat nodeattrs
    • cat nodes
    • cat pending tasks
    • cat plugins
    • cat recovery
    • cat repositories
    • cat thread pool
    • cat shards
    • cat segments
    • cat snapshots
    • cat templates
  • 集群API
    • Cluster Health
    • Cluster State
    • Cluster Stats
    • Pending cluster tasks
    • Cluster Reroute
    • Cluster Update Settings
    • Nodes Stats
    • Nodes Info
    • Task Management API
    • Nodes hot_threads
    • Cluster Allocation Explain API
  • DSL查询
    • Query and filter context
    • Match All Query
    • Full text queries
      • Match Query
      • Match Phrase Query
      • Match Phrase Prefix Query
      • Multi Match Query
      • Common Terms Query
      • Query String Query
      • Simple Query String Query
    • Term level queries
      • Term Query
      • Terms Query
      • Range Query
      • Exists Query
      • Prefix Query
      • Wildcard Query
      • Regexp Query
      • Fuzzy Query
      • Type Query
      • Ids Query
    • Compound queries
      • Constant Score Query
      • Bool Query
      • Dis Max Query
      • Function Score Query
      • Boosting Query
      • Indices Query
    • Joining queries
      • Nested Query
      • Has Child Query
      • Has Parent Query
      • Parent Id Query
    • Geo queries
      • GeoShape Query
      • Geo Bounding Box Query
      • Geo Distance Query
      • Geo Distance Range Query
      • Geo Polygon Query
    • Specialized queries
      • More Like This Query
      • Template Query
      • Script Query
      • Percolate Query
    • Span queries
      • Span Term Query
      • Span Multi Term Query
      • Span First Query
      • Span Near Query
      • Span Or Query
      • Span Not Query
      • Span Containing Query
      • Span Within Query
      • Span Field Masking Query
    • Minimum Should Match
    • Multi Term Query Rewrite
  • Mapping
    • Field datatypes
      • Array datatype
      • Binary datatype
      • Range datatypes
      • Boolean datatype
      • Date datatype
      • Geo-point datatype
      • Geo-Shape datatype
      • IP datatype
      • Keyword datatype
      • Nested datatype
      • Numeric datatypes
      • Object datatype
      • String datatype
      • Text datatype
      • Token count datatype
      • Percolator type
    • Meta-Fields
      • _all field
      • _field_names field
      • _id field
      • _index field
      • _meta field
      • _parent field
      • _routing field
      • _source field
      • _type field
      • _uid field
    • Mapping parameters
      • analyzer
      • normalizer
      • boost
      • coerce
      • copy_to
      • doc_values
      • dynamic
      • enabled
      • fielddata
      • format
      • ignore_above
      • ignore_malformed
      • include_in_all
      • index
      • index_options
      • fields
      • norms
      • null_value
      • position_increment_gap
      • properties
      • search_analyzer
      • similarity
      • store
      • term_vector
    • Dynamic Mapping
      • default mapping
      • Dynamic field mapping
      • Dynamic templates
      • Override default template
  • Analysis
    • Anatomy of an analyzer
    • Testing analyzers
    • Analyzers
      • Configuring built-in analyzers
      • Standard Analyzer
      • Simple Analyzer
      • Whitespace Analyzer
      • Stop Analyzer
      • Keyword Analyzer
      • Pattern Analyzer
      • Language Analyzers
      • Fingerprint Analyzer
      • Custom Analyzer
      • Normalizers
    • Tokenizers
      • Standard Tokenizer
      • Letter Tokenizer
      • Lowercase Tokenizer
      • Whitespace Tokenizer
      • UAX URL Email Tokenizer
      • Classic Tokenizer
      • Thai Tokenizer
      • NGram Tokenizer
      • Edge NGram Tokenizer
      • Keyword Tokenizer
      • Pattern Tokenizer
      • Path Hierarchy Tokenizer
    • Token Filters
      • Standard Token Filter
      • ASCII Folding Token Filter
      • Flatten Graph Token Filter
      • Length Token Filter
      • Lowercase Token Filter
      • Uppercase Token Filter
      • NGram Token Filter
      • Edge NGram Token Filter
      • Porter Stem Token Filter
      • Shingle Token Filter
      • Stop Token Filter
      • Word Delimiter Token Filter
      • Stemmer Token Filter
      • Stemmer Override Token Filter
      • Keyword Marker Token Filter
      • Keyword Repeat Token Filter
      • KStem Token Filter
      • Snowball Token Filter
      • Phonetic Token Filter
      • Synonym Token Filter
      • Synonym Graph Token Filter
      • Compound Word Token Filter
      • Reverse Token Filter
      • Elision Token Filter
      • Truncate Token Filter
      • Unique Token Filter
      • Pattern Capture Token Filter
      • Pattern Replace Token Filter
      • Trim Token Filter
      • Limit Token Count Token Filter
      • Hunspell Token Filter
      • Common Grams Token Filter
      • Normalization Token Filter
      • CJK Width Token Filter
      • CJK Bigram Token Filter
      • Delimited Payload Token Filter
      • Keep Words Token Filter
      • Keep Types Token Filter
      • Classic Token Filter
      • Apostrophe Token Filter
      • Decimal Digit Token Filter
      • Fingerprint Token Filter
      • Minhash Token Filter
    • Character Filters
      • HTML Strip Char Filter
      • Mapping Char Filter
      • Pattern Replace Char Filter
  • 模块
    • 集群
      • 集群的分片分配
      • 基于磁盘的分片分配
      • 了解分片分配
      • 分片分配过滤
      • 其他群集设置
    • Discovery
      • Azure Classic Discovery
      • EC2 Discovery
      • Google Compute Engine Discovery
      • Zen Discovery
    • 本地网关
    • HTTP
    • 索引库
      • 熔断
      • Fielddata
      • 节点查询缓存
      • 索引缓冲
      • 分片请求缓存
      • 索引库恢复
    • 网络设置
    • 节点
    • 插件
    • 脚本
      • 如何使用脚本
      • 文档中字段的访问以及一些特殊变量
      • 脚本与安全
      • Groovy脚本语言
      • PainLess脚本语言
      • PainLess语法
      • PainLess调试
      • Lucene表达式语言
      • 原生(java)脚本
      • 高级文本评分脚本
    • 快照与还原
    • 线程池
    • 传输
    • Tribe节点
    • 跨集群搜索
  • Index模块
    • Analysis
    • Index Shard Allocation
      • Shard Allocation Filtering
      • Delaying allocation when a node leaves
      • Index recovery prioritization
      • Total Shards Per Node
    • Mapper
    • Merge
    • Similarity module
    • Slow Log
    • Store
      • Pre-loading data into the file system cache
    • Translog
  • Ingest节点
    • Pipeline Definition
    • Ingest APIs
      • Put Pipeline API
      • Get Pipeline API
      • Delete Pipeline API
      • Simulate Pipeline API
    • Accessing Data in Pipelines
    • Handling Failures in Pipelines
    • Processors
      • Append Processor
      • Convert Processor
      • Date Processor
      • Date Index Name Processor
      • Fail Processor
      • Foreach Processor
      • Grok Processor
      • Gsub Processor
      • Join Processor
      • JSON Processor
      • KV Processor
      • Lowercase Processor
      • Remove Processor
      • Rename Processor
      • Script Processor
      • Set Processor
      • Split Processor
      • Sort Processor
      • Trim Processor
      • Uppercase Processor
      • Dot Expander Processor
  • How To
    • General recommendations
    • Recipes
    • Tune for indexing speed
    • Tune for search speed
    • Tune for disk usage
  • Testing
    • Java Testing Framework
      • why randomized testing?
      • Using the elasticsearch test classes
      • unit tests
      • integration tests
      • Randomized testing
      • Assertions
  • 术语表
  • 发布说明
    • 5.3.0 Release Notes
    • 5.2.2 Release Notes
    • 5.2.1 Release Notes
    • 5.2.0 Release Notes
    • 5.1.2 Release Notes
    • 5.1.1 Release Notes
    • 5.1.0 Release Notes
    • 5.0.2 Release Notes
    • 5.0.1 Release Notes
    • 5.0.0 Combined Release Notes
    • 5.0.0 GA Release Notes
    • 5.0.0-rc1 Release Notes
    • 5.0.0-beta1 Release Notes
    • 5.0.0-alpha5 Release Notes
    • 5.0.0-alpha4 Release Notes
    • 5.0.0-alpha3 Release Notes
    • 5.0.0-alpha2 Release Notes
    • 5.0.0-alpha1 Release Notes
    • 5.0.0-alpha1 Release Notes (Changes previously released in 2.x)
  • Painless API参考文档
Powered by GitBook
On this page
  • 优雅的结果
  • 人类可读的输出(Human readable output)
  • 日期运算
  • 响应过滤(respoonse filtering)
  • 扁平设置
  • 参数(Parameters)
  • 布尔值(Boolean Values)
  • 数值
  • 时间单位(Time units)
  • 字节大小单位
  • 无单位数量(unit-less quantities)
  • 距离单位(distance units)
  • 模糊性(Fuzziness)
  • 启用堆栈跟踪
  • 请求体作为查询字符串
  • Content-Type自动探测

Was this helpful?

  1. API约定

常用选项

Previous索引库名称的日期运算NextURL-based访问控制

Last updated 4 years ago

Was this helpful?

以下选项可以应用于所有 REST APIs 。

优雅的结果

当对任何请求追加?pretty=true时,返回的JSON将会优雅地格式化(仅用于调试!)。另一个选项是设置?format = yaml,这将使结果以(有时)更可读的 yaml格式返回。

人类可读的输出(Human readable output)

以适合人类的格式(例如 "exists_time":"1h" 或者 "size":"1kb")和计算机(例如 "exists_time_in_millis":"3600000" 或者 "size_in_bytes":"1024")返回统计信息。通过向查询字符串中添加?human=false可以关闭人类可读的值。当统计结果被监视工具消费而不是用于人类消费时,这将是有意义的。人性化标志的默认值是false。

日期运算

接受格式化的日期值的参数大多数都支持日期运算——譬如使用gt与lt的,或者使用from与to的。

表达式以锚定日期开始,可以是now,也可以||结尾的日期字符串。此锚定日期可以选择性地后跟一个或多个数学表达式:

数学表达式

含义

+1h

加一个小时(add one hour)

-1d

减去一天(subtract one day)

/d

向下舍入到最近的一天(round down to the nearest day)

所支持的时间单位不同于。所支持的单位是:

符号

含义

y

years

M

months

w

weeks

d

days

h

hours

H

hours

m

minutes

s

seconds

下面是一些例子:

表达式

含义

now+1h

当前时间加上一个小时,以毫秒(ms)为单位

now+1h+1m

当前时间加上一个小时一分钟,以毫秒(ms)为单位

now+1h/d

当前时间加上一个小时,向下舍入到最近的一天。

2015-01-01

+1M/d

2015-01-01 加一个月,向下舍入到最近一天。

响应过滤(respoonse filtering)

所有REST API都支持可用于减少elasticsearch返回的filter_path参数。此参数是采用,分隔,且支持.符号表达:

GET /_search?q=elasticsearch&filter_path=took,hits.hits._id,hits.hits._score

响应(Responds):

{
  "took" : 3,
  "hits" : {
    "hits" : [
      {
        "_id" : "0",
        "_score" : 1.6375021
      }
    ]
  }
}

并且*通配符可以用于包括不知道确切路径的字段。例如:

GET /_cluster/state?filter_path=routing_table.indices.**.state

响应(Responds):

{
  "routing_table": {
    "indices": {
      "twitter": {
        "shards": {
          "0": [{"state": "STARTED"}, {"state": "UNASSIGNED"}],
          "1": [{"state": "STARTED"}, {"state": "UNASSIGNED"}],
          "2": [{"state": "STARTED"}, {"state": "UNASSIGNED"}],
          "3": [{"state": "STARTED"}, {"state": "UNASSIGNED"}],
          "4": [{"state": "STARTED"}, {"state": "UNASSIGNED"}]
        }
      }
    }
  }
}

也可以通过使用字符-过滤器来排除一个或多个字段:

GET /_count?filter_path=-_shards

响应(Responds):

{
  "count" : 5
}

为了更多的控制,包含和独占过滤器可以组合在同一个表达式。在这种情况下,将首先应用独占过滤器,并使用包含过滤器再次过滤:

GET /_cluster/state?filter_path=metadata.indices.*.state,-metadata.indices.logstash-*

响应(Responds):

{
  "metadata" : {
    "indices" : {
      "index-1" : {"state" : "open"},
      "index-2" : {"state" : "open"},
      "index-3" : {"state" : "open"}
    }
  }
}
POST /library/book?refresh
{"title": "Book #1", "rating": 200.1}
POST /library/book?refresh
{"title": "Book #2", "rating": 1.7}
POST /library/book?refresh
{"title": "Book #3", "rating": 0.1}
GET /_search?filter_path=hits.hits._source&_source=title&sort=rating:desc
{
  "hits" : {
    "hits" : [ {
      "_source":{"title":"Book #1"}
    }, {
      "_source":{"title":"Book #2"}
    }, {
      "_source":{"title":"Book #3"}
    } ]
  }
}

扁平设置

flat_settings参数影响设置列表的呈现。当flat_settings设置为true时,结果将以扁平的格式返回:

GET twitter/_settings?flat_settings=true

返回(Returns):

{
  "twitter" : {
    "settings": {
      "index.number_of_replicas": "1",
      "index.number_of_shards": "1",
      "index.creation_date": "1474389951325",
      "index.uuid": "n6gzFZTgS664GUfx0Xrpjw",
      "index.version.created": ...,
      "index.provided_name" : "twitter"
    }
  }
}

当flat_settings设置为false时,设置以更易于阅读的结构化格式返回:

GET twitter/_settings?flat_settings=false

返回(Returns):

{
  "twitter" : {
    "settings" : {
      "index" : {
        "number_of_replicas": "1",
        "number_of_shards": "1",
        "creation_date": "1474389951325",
        "uuid": "n6gzFZTgS664GUfx0Xrpjw",
        "version": {
          "created": ...
        },
        "provided_name" : "twitter"
      }
    }
  }
}

默认情况下, flat_settings被设置为false。

参数(Parameters)

Rest 参数(当使用 HTTP 时,映射到 HTTP URL 参数)遵循使用下划线框的惯例。

布尔值(Boolean Values)

所有REST APIs参数(请求参数和 JSON 正文)支持以下值作为布尔值“false”:false,0,no和off。所有其他值均被视为“true”。

警告

5.3.0已废弃

除“false”与“true”之外的其他值都被废弃。

数值

所有REST API都支持以字符串的形式来提供数字,以支持JSON数字类型。

时间单位(Time units)

每当需要指定持续时间时,譬如timeout参数,持续时间必须指定单位,如2d为2天。支持的单位有:

符号

含义

d

days

h

hours

m

minutes

s

seconds

ms

milliseconds

micros

microseconds

nanos

nanoseconds

字节大小单位

每当需要指定数据的字节大小时,例如,当设置缓冲区(buffer)大小参数时,该值必须指定单位,例如10千字节的10kb。支持的单位有:

单位

全称

b

Bytes

kb

Kilobytes

mb

Megabytes

gb

Gigabytes

tb

Terabytes

pb

Petabytes

无单位数量(unit-less quantities)

无单位数量意味着它们没有像“字节(bytes)”或者“赫兹(Hertz)”或者“米(meter)”或者“长吨(long tonne)” 的“单位”。 如果这些数量中的一个很大,我们将打印出来,如10,000万的 10m 或者 7,000 的 7k 。我们仍然打印 87 ,当我们的意思是 87 。这些是支持的乘数(multipliers):

符号

含义

``

Single

k

Kilo

m

Mega

g

Giga

t

Tera

p

Peta

距离单位(distance units)

无论在何处需要指定距离,例如“地理距离查询”中的距离参数,默认单位(如果没有指定)是 米(meter)。距离可以用其他单位指定,例如 “1公里(km)”或者“2公里(mi)”(2英里)。

单位的完整列表如下:

单位

表示符号

Mile

mi 或者 miles

Yard

yd 或者 yards

Feet

ft 或者 feet

Inch

in 或者 inch

Kilometer

km 或者 kilometers

Meter

m 或者 meters

Centimeter

cm 或者 centimeters

Millimeter

mm 或者 millimeters

Nautical mile

NM, nmi 或者 nauticalmiles

模糊性(Fuzziness)

一些查询和 APIs 支持参数以允许使用模糊性参数进行不精确的模糊匹配。

当查询文本(text)或者关键字字段(keyword fields)时,模糊性被解释为 Levenshtein Edit Distance —— 需要对一个字符串进行更改以使其与另一个字符串相同的一个字符的数目。

fuzziness参数可以指定为:

0, 1, 2

最大允许 Levenshtein Edit Distance (或者编辑次数)。

AUTO

基于该项的长度生成编辑距离(generates an edit distance)。对于长度:

  0..2

     必须完全匹配

  3..5

    允许编辑一次(one edit allowed)

  >5

    允许编辑两次(two edits allowed)

AUTO一般应该是fuzziness的首选值。

启用堆栈跟踪

默认情况下,当请求返回错误时,Elasticsearch不包括错误的堆栈跟踪。您可以将error_trace参数设置为true来启用该行为。例如,默认情况下,当您向_searchAPI 发送无效的size参数时:

POST /twitter/_search?size=surprise_me

响应看起来像下面这样:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Failed to parse int parameter [size] with value [surprise_me]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Failed to parse int parameter [size] with value [surprise_me]",
    "caused_by" : {
      "type" : "number_format_exception",
      "reason" : "For input string: \"surprise_me\""
    }
  },
  "status" : 400
}

但是,如果您设置error_trace=true:

POST /twitter/_search?size=surprise_me&error_trace=true

响应看起来像这样:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Failed to parse int parameter [size] with value [surprise_me]",
        "stack_trace": "Failed to parse int parameter [size] with value [surprise_me]]; nested: IllegalArgumentException..."
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Failed to parse int parameter [size] with value [surprise_me]",
    "stack_trace": "java.lang.IllegalArgumentException: Failed to parse int parameter [size] with value [surprise_me]\n    at org.elasticsearch.rest.RestRequest.paramAsInt(RestRequest.java:175)...",
    "caused_by": {
      "type": "number_format_exception",
      "reason": "For input string: \"surprise_me\"",
      "stack_trace": "java.lang.NumberFormatException: For input string: \"surprise_me\"\n    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)..."
    }
  },
  "status": 400
}

请求体作为查询字符串

对于不接受请求体的non-POST请求,你可以把请求体粘贴到查询字符串的source参数来执行。在使用吃方法时,需要通过source_content_type参数指定媒体类型来表明数据来源的格式,譬如:application/json。

Content-Type自动探测

参数内容通过请求主体或者是查询字符串source来传递时会自动探测内容的类型(JSON、YAML、SMILE、或者CBOR)。

严格的模式可以开启禁用自动探测,然后需要在请求头的Content-Type中设置支持的格式。若要开启严格模式,请添加如下行到elasticsearch.yml文件:

http.content_type.required: true

它的默认值为false。

请注意, elasticsearch有时直接返回字段的原始值,如_source字段。如果要过滤_source字段,你需要结合filter_path参数来考虑已存在_source参数。(请参阅了解更多详细信息 ),如下所示:

范围查询
日期范围聚合
持续时间支持的时间单位
Get API