# How to Select \* from Doc where description like '%keju%' and purchasedId = 'PG.R.UNC.01'

**URL:** <https://discuss.elastic.co/t/how-to-select-from-doc-where-description-like-keju-and-purchasedid-pg-r-unc-01/204204>\
**Category:** Elasticsearch\
**Created:** [October 18, 2019, 10:38am UTC](https://discuss.elastic.co/t/how-to-select-from-doc-where-description-like-keju-and-purchasedid-pg-r-unc-01/204204 "2019-10-18T10:38:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmad\_Teguh\_Satria](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmad_teguh_satria/32/56159_2.png) [@Ahmad\_Teguh\_Satria](https://discuss.elastic.co/u/Ahmad_Teguh_Satria)\
**Post date:** [October 18, 2019, 10:38am UTC](https://discuss.elastic.co/t/how-to-select-from-doc-where-description-like-keju-and-purchasedid-pg-r-unc-01/204204/1 "2019-10-18T10:38:12Z")

</div>

Hello, i'm new on elastic search, still not understand how using query for elastic search

i have data

like this one

```
{
	"_index" : "normal",
	"_type" : "product",
	"_id" : "002417",
	"_score" : 0.93070257,
	"_source" : {	
		"ListPurchasedGroupId" : [
			{
				"Value" : "PG.R.BKS.01"
			},
			{
				"Value" : ""PG.R.UNC.01""
			}
		],

		"ProductId" : "002417",
		"Name" : "Richeese Bisvit Selimut Rch 20 x 11 g",
		"BrandName" : "",
		"PrincipalName" : "Nabati",
		"Description" : "Biskuit sandwich salut krim keju",
		"RelevanceName" : "biskuit",
		"DtmLastUpdate" : "2019-09-16T20:59:31"
	}
},
{
    "_index" : "normal",
    "_type" : "product",
    "_id" : "002418",
    "_score" : 4.82661,
    "_source" : {
        "ListPurchasedGroupId" : [
            {
                "Value" : "PG.R.BKS.01"
            }
        ],

        "ProductId" : "002418",
        "Name" : "Richeese Biscuit Selimut Rch 50 x 11 g",
        "BrandName" : "",
        "PrincipalName" : "Nabati",
        "Description" : "Biskuit sandwich salut krim keju enak",
        "RelevanceName" : "biskuit",
        "DtmLastUpdate" : "2019-09-16T20:59:31"
    }
},

```

how can i select data by Description AND by ListPurchasedGroupId.Value

already trying using this

```
GET /normal/product/_search
{
  "query": {
    "bool": {
      "must": [
          {
            "match": {
              "Description" : "Keju "
            }
          },
          {
            "nested": {
              "path": "ListPurchasedGroupId",
              "query": {
                  "bool":{
                      "must":[
                        {
                          "match": {"ListPurchasedGroupId.Value": "PG.R.UNC.01"}
                        }  
                      ]
                  }
              }
            }
          }
      ]
    }
  }
}

```

but i still got the productId 002418  
this product didnt have purchasedGroupId = "PG.R.UNC.01"  
how to fix it?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 18, 2019, 4:10pm UTC](https://discuss.elastic.co/t/how-to-select-from-doc-where-description-like-keju-and-purchasedid-pg-r-unc-01/204204/2 "2019-10-18T16:10:33Z")

</div>

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 18, 2019, 4:23pm UTC](https://discuss.elastic.co/t/how-to-select-from-doc-where-description-like-keju-and-purchasedid-pg-r-unc-01/204204/3 "2019-10-18T16:23:37Z")

</div>

What is the mapping for those fields? Are they by any chance text?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 15, 2019, 4:23pm UTC](https://discuss.elastic.co/t/how-to-select-from-doc-where-description-like-keju-and-purchasedid-pg-r-unc-01/204204/4 "2019-11-15T16:23:39Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
