如何在ElasticSearch中过滤数组对象

时间:2019-05-15 14:26:08

标签: elasticsearch

我有一个类似的结果查询:

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 6,
    "successful" : 6,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 15.0735855,
    "hits" : [
      {
        "_index" : "khoso",
        "_type" : "sim",
        "_id" : "0964693123",
        "_score" : 15.0735855,
        "_source" : {
          "id" : "0964693123",
          "i" : "0964693123",
          "ut" : 10,
          "utP" : 1,
          "utT" : 1,
          "utC" : 1,
          "f" : "09646.93.123",
          "s" : [
            {
              "id" : 268,
              "p" : 800000,
              "pb" : 800000,
              "pg" : 560000,
              "l" : {
                "sec" : 0,
                "usec" : 0
              },
              "da" : {
                "sec" : 0,
                "usec" : 0
              },
              "d" : true,
              "d3" : true,
              "d2" : true
            },
            {
              "id" : 2067,
              "p" : 750000,
              "pb" : 699000,
              "pg" : 524250,
              "l" : {
                "sec" : 0,
                "usec" : 0
              },
              "da" : {
                "sec" : 0,
                "usec" : 0
              },
              "d" : true,
              "d3" : true,
              "d2" : true
            }
          ],
          "s2" : [
            268,
            2067
          ],
          "pt" : 4.5,
          "m" : 10,
          "p" : 0,
          "pb" : 800000,
          "pg" : 560000,
          "c" : [
            81,
            111
          ],
          "c2" : 81,
          "t" : 1,
          "d" : true,
          "d2" : true,
          "l" : {
            "sec" : 0,
            "usec" : 0
          },
          "d3" : true,
          "h" : true,
          "hg" : true,
          "e" : "693123",
          "pn" : 960000,
          "s3" : [ ]
        }
      }
    ]
  }
}

现在我要删除此数组中的对象。例如,我要删除id == 268的对象。像这样

{
    "took" : 2,
    "timed_out" : false,
    "_shards" : {
        "total" : 6,
        "successful" : 6,
        "skipped" : 0,
        "failed" : 0
    },
    "hits" : {
      "total" : 1,
      "max_score" : 15.0735855,
      "hits" : [
      {
          "_index" : "khoso",
          "_type" : "sim",
          "_id" : "0964693123",
          "_score" : 15.0735855,
          "_source" : {
              "id" : "0964693123",
              "i" : "0964693123",
              "ut" : 10,
              "utP" : 1,
              "utT" : 1,
              "utC" : 1,
              "f" : "09646.93.123",
              "s" : [
              {
                  "id" : 2067,
                  "p" : 750000,
                  "pb" : 699000,
                  "pg" : 524250,
                  "l" : {
                      "sec" : 0,
                      "usec" : 0
                  },
                  "da" : {
                      "sec" : 0,
                      "usec" : 0
                  },
                  "d" : true,
                  "d3" : true,
                  "d2" : true
              }
          ],
          "s2" : [
              268,
              2067
          ],
          "pt" : 4.5,
          "m" : 10,
          "p" : 0,
          "pb" : 800000,
          "pg" : 560000,
          "c" : [
              81,
              111
          ],
          "c2" : 81,
          "t" : 1,
          "d" : true,
          "d2" : true,
          "l" : {
              "sec" : 0,
              "usec" : 0
          },
          "d3" : true,
          "h" : true,
          "hg" : true,
          "e" : "693123",
          "pn" : 960000,
          "s3" : [ ]
      }
   }
   ]
   }
}

我该怎么办?请给我一些查询以执行此操作。谢谢!

0 个答案:

没有答案