Elasticsearch: Duplicate properties in a single record

时间:2018-03-23 00:02:18

标签: elasticsearch elasticsearch-5

I have to find every document in Elasticsearch that has duplicate properties. My mapping looks something like this:

        "type": {
        "properties": {
            "thisProperty": {
                "properties" : {
                    "id":{
                        "type": "keyword"
                    },
                    "other_id":{
                        "type": "keyword"
                    }
                }
            }

The documents I have to find have a pattern like this:

    "thisProperty": [
    {
        "other_id": "123",
        "id": "456"
    },
    {
        "other_id": "123",
        "id": "456"
    },
    {
        "other_id": "4545",
        "id": "789"
    }]

So, I need to find any document by type that has repeat property fields. Also I cannot search by term because I do not what the value of either Id field is. So far the API hasn't soon a clear way to do this via query and the programmatic approach is possible but cumbersome. Is it possible to get this result set in a elasticsearch query? If so, how?

(The version of Elasticsearch is 5.3)

0 个答案:

没有答案
相关问题