Elasticsearch 6.2.4:如何从有序文档中获取不同的值?

时间:2018-10-31 08:00:53

标签: elasticsearch

以下是文档:

{
    "name": "Micheal",
    "title": "appliaction engeneer",
    "age": 30,
    "interest": "java",
    "manager": "Amily"
},
{
    "name": "Georgiana",
    "title": "appliaction engeneer",
    "age": 34,
    "interest": "java",
    "manager": "Amily"
},
{
    "name": "Benjamin",
    "title": "Product Manager",
    "age": 36,
    "interest": "management",
    "manager": "robinson "
},
{
    "name": "Selina",
    "title": "appliaction engeneer",
    "age": 30,
    "interest": "java",
    "manager": "Grey "
},
{
    "name": "Edison",
    "title": "appliaction engeneer",
    "age": 26,
    "interest": ".net",
    "manager": "Amily "
}

现在我需要从文档中精确提取三个字段title, age, interest

结果应类似于:

{
    "title": "appliaction engeneer",
    "age": 30,
    "interest": "java",
},
{
    "title": "appliaction engeneer",
    "age": 34,
    "interest": "java",
},
{
    "title": "Product Manager",
    "age": 36,
    "interest": "management",
},
{
    "title": "appliaction engeneer",
    "age": 26,
    "interest": ".net",
}

重复记录中的一条,如下面一条,应删除。

{
    "title": "appliaction engeneer",
    "age": 30,
    "interest": "java"
}

最重要的是,获取的记录的顺序应与文档一致。

我们如何实现这一目标?

0 个答案:

没有答案