# Complex case

**URL:** <https://discuss.elastic.co/t/complex-case/79749>\
**Category:** Elasticsearch\
**Created:** [March 23, 2017, 12:55pm UTC](https://discuss.elastic.co/t/complex-case/79749 "2017-03-23T12:55:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alkalit](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@Alkalit](https://discuss.elastic.co/u/Alkalit)\
**Post date:** [March 23, 2017, 12:55pm UTC](https://discuss.elastic.co/t/complex-case/79749/1 "2017-03-23T12:55:35Z")

</div>

I have users search queries, ads and cities.

The problem: I need to list search queries (phrases) that looks similar to the requested and make sure that they have ads in selected city.

For example: A user asked "buy a phone" and this query is similar to "buy a smartphone" and "buy an iphone". Then we show to user both  
"buy a smartphone" and "buy an iphone" queries as similar because there is ads in a city that falls under these queries.  
But when the user performs the query, say, in Moscow we list only "buy a smartphone" because there is no iphones in our ads in Moscow.

How do i accomplish this?

---

<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:** [April 20, 2017, 12:55pm UTC](https://discuss.elastic.co/t/complex-case/79749/2 "2017-04-20T12:55:44Z")

</div>

Closed on April 20, 2017, 12:55pm UTC

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