1<?php 2 3namespace Elastica\Query; 4 5/** 6 * ParentId query. 7 * 8 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-parent-id-query.html 9 */ 10class ParentId extends AbstractQuery 11{ 12 /** 13 * ParentId constructor. 14 * 15 * @param string $type 16 * @param int|string $id 17 * @param bool $ignoreUnmapped 18 */ 19 public function __construct(string $type, $id, bool $ignoreUnmapped = false) 20 { 21 $this->setType($type); 22 $this->setId($id); 23 $this->setIgnoreUnmapped($ignoreUnmapped); 24 } 25 26 /** 27 * @param string $type 28 */ 29 private function setType(string $type) 30 { 31 $this->setParam('type', $type); 32 } 33 34 /** 35 * @param int|string $id 36 */ 37 private function setId($id) 38 { 39 $this->setParam('id', $id); 40 } 41 42 /** 43 * @param bool $ignoreUnmapped 44 */ 45 private function setIgnoreUnmapped(bool $ignoreUnmapped = false) 46 { 47 $this->setParam('ignore_unmapped', $ignoreUnmapped); 48 } 49} 50