# Store users' search queries within index and search against those queries

**URL:** https://discuss.elastic.co/t/store-users-search-queries-within-index-and-search-against-those-queries/122486
**Category:** Elasticsearch
**Created:** [March 5, 2018, 11:04am UTC](https://discuss.elastic.co/t/store-users-search-queries-within-index-and-search-against-those-queries/122486 "2018-03-05T11:04:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![GrigoryPtashko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grigoryptashko/32/27606_2.png) [@GrigoryPtashko](https://discuss.elastic.co/u/GrigoryPtashko)
#### Post date: [March 5, 2018, 11:04am UTC](https://discuss.elastic.co/t/store-users-search-queries-within-index-and-search-against-those-queries/122486/1 "2018-03-05T11:04:31Z")

</div>

I have an index containing the type with blog posts.  
I want to have another type within this index with two fields:

user id and the user's search query

After every blog posts type insert I want to execute a search  
that will find all users' ids whose search queries match the inserted  
blog post.

Currently I'm doing this within my RDBMS with a bunch of joins.  
I'm converting full text searches to Elastic and do not understand  
how to

1. store these users' queris
2. how to execute such a query

I guess this is a common pattern. I just don't feel Elastic enough not to  
ask for help here.

Thanks!

---

<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 2, 2018, 11:04am UTC](https://discuss.elastic.co/t/store-users-search-queries-within-index-and-search-against-those-queries/122486/2 "2018-04-02T11:04:38Z")

</div>

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