# How to write Filters with conditions as NOT LIKE '%abc%' in app search

**URL:** <https://discuss.elastic.co/t/how-to-write-filters-with-conditions-as-not-like-abc-in-app-search/246104>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [August 24, 2020, 11:14am UTC](https://discuss.elastic.co/t/how-to-write-filters-with-conditions-as-not-like-abc-in-app-search/246104 "2020-08-24T11:14:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aditi\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aditi_jain/32/74383_2.png) [@aditi\_jain](https://discuss.elastic.co/u/aditi_jain)\
**Post date:** [August 24, 2020, 11:14am UTC](https://discuss.elastic.co/t/how-to-write-filters-with-conditions-as-not-like-abc-in-app-search/246104/1 "2020-08-24T11:14:51Z")

</div>

There is a field like allergyconflict in app search documents that has a list of allergies for the product. **This is stored as a comma separated string.**  
Eg - A product of milk has allergyconflicts as - "corn,lactose,milk" and another product of milk has allergyconflicts as -"corn".  
I need to implement a filter such that I get milk products **which do not have "corn" as allergy conflict**.

For that if I write the below query, it will not eliminate the product which has "corn,lactose,milk" in the value.

```auto
{
	"query": "milk",
	"filters": {
		"none": [
			{ "allergyconflicts": ["corn"] }
		]
	}
}

```

**Basically I need to implement a filter with Not Like '%corn%' condition.**  
Is there any way I can do that?

---

<div class="post-metadata">

**Author:** ![orhantoy](https://avatars.discourse-cdn.com/v4/letter/o/c5a1d2/32.png) [@orhantoy](https://discuss.elastic.co/u/orhantoy)\
**Post date:** [August 27, 2020, 1:34pm UTC](https://discuss.elastic.co/t/how-to-write-filters-with-conditions-as-not-like-abc-in-app-search/246104/2 "2020-08-27T13:34:28Z")

</div>

Filtering perform exact matches so I think you instead could store the data in the `allergyconflicts` field as an array of strings and not a single string with comma separated values.

---

<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:** [September 24, 2020, 1:34pm UTC](https://discuss.elastic.co/t/how-to-write-filters-with-conditions-as-not-like-abc-in-app-search/246104/3 "2020-09-24T13:34:32Z")

</div>

Closed on September 24, 2020, 1:34pm UTC

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