- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Elasticsearch suggested在我的例子中禁用 _source
和 _all
字段,这是我的映射
{
"template": "mq-body-*",
"settings": {
"number_of_shards": 3,
"number_of_replicas": 0,
"max_result_window": 100,
"codec": "best_compression"
},
"mappings": {
"_default_": {
"_source": {
"enabled": false
},
"_all": {
"enabled": false
}
},
"body": {
"properties": {
"body": {
"type": "string",
"doc_values": true,
"index": "not_analyzed"
}
}
}
}
}
body.body
是一个非常大的字段(20k-300k),我们不必索引并且很少获得,这是可能丢失的。但之后
PUT /mq-body-local/body/1
{"body":"My body"}
我无法通过 GET/mq-body-local/body/1?fields=body
或 POST/mq-body-local/body/_search -d 找到正文'{"fields":["body"]}'
,结果找到一个但没有文档。我知道没有_source
我不能get
或 search
,但如何检索我的文档?
最佳答案
来自 Elasticsearch 的网站:
The _source field contains the original JSON document body that was passed at index time. The _source field itself is not indexed (and thus is not searchable), but it is stored so that it can be returned when executing fetch requests, like get or search
禁用源将阻止 Elasticsearch 在结果集中显示它。但过滤、查询和聚合不会受到影响。
因此这两个查询不会生成任何实际结果:
获取 mq-body-local/body/_search
获取 mq-body-local/body/1
但是,您可以运行此聚合,其中将包含一些源,例如:
POST mq-body-local/body/_search
{
"aggs": {
"test": {
"terms": {
"field": "body"
}
}
}
}
将产生这个结果集(我已经创建了一些测试记录):
"aggregations": {
"test": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "my body",
"doc_count": 1
},
{
"key": "my body2",
"doc_count": 1
}
]
}
}
关于elasticsearch - 如果我在 Elasticsearch 中禁用 _source 和 _all,我可以获得一个字段吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34918217/
我刚刚开始学习elasticsearch,想知道我从elasticsearch website复制的以下句子中的术语和值之间的区别是什么: "It is important to note that
我嵌套,您如何产生此请求: GET demo_covariant/_all/2 最佳答案 client.Get(2, g => g .Index("demo_covariant") .
我想从elasticsearch的“_all”字段中删除所有数字和日期。这样可以减小尺寸并提高性能。我以为可以通过使用dynamic_templates完成此操作,但我无法使其正常工作。 映射是这样的
我没有得到 THIS示例为什么以下两个查询返回 12 作为结果计数?帖子解释说数据在 _all 中的索引方式是不同的。但它并没有解释它。有人可以帮我理解这一点。 GET /_search?q=2014
我是Elasticsearch的新手。我们需要索引和检索具有不同数据类型的某些数据。我们正在使用自定义“_all”字段,如以下链接中所述 Custom "_all" fields 以下是我们的代码 用
我在 elasticsearch 中有一个过滤别名,我使用“_all”作为绑定(bind)的索引创建了该别名。像这样: curl -XPOST "localhost:9200/_aliases" -d
我有索引“index”并输入了“fulltext”,但是当我尝试通过https://www.elastic.co/guide/en/elasticsearch/reference/6.0/mappin
我有一个分割的字段,例如: //name .startObject(IndexConstants.FIRST_NAME) .f
我正在尝试在 match 中实现Elasticsearch搜索,并且我注意到行为是不同的,具体取决于我是否使用_all还是输入特定的字符串值作为查询的字段名称。 为了提供一些背景信息,我创建了具有以下
我相信这是Rails 3中的一个错误。我希望这里的人能够引导我朝正确的方向发展。下面发布的代码仅用于说明此问题。希望这不会混淆这个问题。 给定我有一个Post模型和一个Comment模型。发表has_
Elasticsearch suggested在我的例子中禁用 _source 和 _all 字段,这是我的映射 { "template": "mq-body-*", "settings":
我正在使用 tire 来实现对 Rails 应用程序的搜索。该应用程序由实现 ActiveModel 的 CouchDB 和 couchrest_model gem 提供支持。 从自述文件可以看出有一
(Elasticsearch 5.2.2) 我在突出显示以正常工作方面遇到了一些麻烦。 我的映射具有2个自定义创建的_all-fields myall1 和 myall2 ,它们是通过 copy_to
我是一名优秀的程序员,十分优秀!