好的,到目前为止我还没能弄明白这件事.希望有人能提供一些见解.

Given the documents below, how would I search for all documents with a video that has "test" in the video title? I'm using the HTTP API. (Basically, how do you search nested objects with elastic search? I know there has to be docs out there, but I haven't really been able to find any.)

[{
    id:4635,
    description:"This is a test description",
    author:"John",
    author_id:51421,
    video: {
        title:"This is a test title for a video",
        description:"This is my video description",
        url:"/url_of_video"
    }
},
{
    id:4636,
    description:"This is a test description 2",
    author:"John",
    author_id:51421,
    video: {
        title:"This is an example title for a video",
        description:"This is my video description2",
        url:"/url_of_video2"
    }
},
{
    id:4637,
    description:"This is a test description3",
    author:"John",
    author_id:51421,
    video: {
        title:"This is a test title for a video3",
        description:"This is my video description3",
        url:"/url_of_video3"
    }
}]

推荐答案

好的,我终于找到了这些页面(应该事先花更多时间处理文档),似乎我们将保存视频的属性设置为type:nested,然后使用nested查询.

http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html

http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-filter.html

希望这对以后的人有所帮助.

Json相关问答推荐

为什么terraform不缩小这个策略JSON?'

使用Jolt变换转换JsonArray以将关键字转移到内部JsonArray中

使用Jolt将字符串数组转换为JSON对象数组

如何使用Aeson解码带有Unicode字符的JSON文件?

如何使用PlayWriter循环访问JSON对象

GO KaZaam转换返回意外结果

使用jq过滤复杂json对象中的数据

如何使用jq使用子值对象的键对json对象进行分组

如何在 JSonPath 中按值查找列表中的所有元素

将=分隔值文件转换为:json文件

将 JSON 字符串解析为 Kotlin Android 中的对象列表(MOSHI?)

如何在jolt中使用shift和modify-overwrite-beta

在 rust 中从 API 反序列化 serde_json

如何在生产环境中更改 Flutter 应用程序中的数据模型?

按 JSON 数据类型 postgres 排序

在 Http Header 中使用 Json 字符串

Jsonpath 与 Jackson 或 Gson

如何使用 Newtonsoft.Json 包在 C#(4.0) 中解析我的 json 字符串?

MVC JsonResult camelCase 序列化

如何从 MVC 控制器返回 Json 对象以查看