# Please help with the search for

**URL:** https://discuss.elastic.co/t/please-help-with-the-search-for/10500
**Category:** Elasticsearch
**Created:** [January 25, 2013, 6:21am UTC](https://discuss.elastic.co/t/please-help-with-the-search-for/10500 "2013-01-25T06:21:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![11114](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/11114/32/8524_2.png) [@11114](https://discuss.elastic.co/u/11114)
#### Post date: [January 25, 2013, 6:21am UTC](https://discuss.elastic.co/t/please-help-with-the-search-for/10500/1 "2013-01-25T06:21:35Z")

</div>

I have a index with 2 types

1. The price of the goods  
[http://localhost:9200/tovar/prices](http://localhost:9200/tovar/prices)

2. Goods  
[http://localhost:9200/tovar/product](http://localhost:9200/tovar/product)

In tovar/prices there is a field tovar\_id which corresponds to the \_id type  
tovar/product  
Task: I need to first search for goods, and in найдных goods to withdraw  
their prices  
Example:

It is a product that  
tovar/product - {  
\_id: 11  
"name" : "Tovar name 1"  
}

This is his prices  
tovar/prices - {  
\_id: 1  
"tovar\_id": 11  
}  
If I do a search request of the goods: "Tovar name 1" I need to bring 2  
entries with tovar/product and tovar/prices

1. tovar/product - because there is compliance by name ("name" : "Tovar  
name 1")
2. tovar/prices - there is a correspondence of the tovar\_id ("tovar\_id":
3. because the product ("name" : "Tovar name 1") \_id=11

---

<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: [January 25, 2013, 7:08am UTC](https://discuss.elastic.co/t/please-help-with-the-search-for/10500/2 "2013-01-25T07:08:37Z")

</div>

Why not indexing product with its price?

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 25 janv. 2013 à 07:21, Николай Измайлов [nekulin123@gmail.com](mailto:nekulin123@gmail.com) a écrit :

I have a index with 2 types

1. The price of the goods  
[http://localhost:9200/tovar/prices](http://localhost:9200/tovar/prices)

2. Goods  
[http://localhost:9200/tovar/product](http://localhost:9200/tovar/product)

In tovar/prices there is a field tovar\_id which corresponds to the \_id type tovar/product  
Task: I need to first search for goods, and in найдных goods to withdraw their prices  
Example:

It is a product that  
tovar/product - {  
\_id: 11  
"name" : "Tovar name 1"  
}

This is his prices  
tovar/prices - {  
\_id: 1  
"tovar\_id": 11  
}  
If I do a search request of the goods: "Tovar name 1" I need to bring 2 entries with tovar/product and tovar/prices

1. tovar/product - because there is compliance by name ("name" : "Tovar name 1")
2. tovar/prices - there is a correspondence of the tovar\_id ("tovar\_id": 11) because the product ("name" : "Tovar name 1") \_id=11

--

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [February 2, 2013, 12:32am UTC](https://discuss.elastic.co/t/please-help-with-the-search-for/10500/3 "2013-02-02T00:32:46Z")

</div>

Indexing everything in single index is definitely a good  
idea. Alternatively, you can index prices as children of products and use  
has\_parent filter to search for prices given the product name.

On Friday, January 25, 2013 2:08:37 AM UTC-5, David Pilato wrote:

> Why not indexing product with its price?
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 25 janv. 2013 à 07:21, Николай Измайлов \<[nekul...@gmail.com](mailto:nekul...@gmail.com)\<javascript:\>\>  
> a écrit :
> 
> I have a index with 2 types
> 
> 1. The price of the goods  
> [http://localhost:9200/tovar/prices](http://localhost:9200/tovar/prices)
> 
> 2. Goods  
> [http://localhost:9200/tovar/product](http://localhost:9200/tovar/product)
> 
> In tovar/prices there is a field tovar\_id which corresponds to the \_id  
> type tovar/product  
> Task: I need to first search for goods, and in найдных goods to withdraw  
> their prices  
> Example:
> 
> It is a product that  
> tovar/product - {  
> \_id: 11  
> "name" : "Tovar name 1"  
> }
> 
> This is his prices  
> tovar/prices - {  
> \_id: 1  
> "tovar\_id": 11  
> }  
> If I do a search request of the goods: "Tovar name 1" I need to bring 2  
> entries with tovar/product and tovar/prices
> 
> 1. tovar/product - because there is compliance by name ("name" : "Tovar  
> name 1")
> 2. tovar/prices - there is a correspondence of the tovar\_id ("tovar\_id":
> 3. because the product ("name" : "Tovar name 1") \_id=11

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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: [July 6, 2017, 2:53am UTC](https://discuss.elastic.co/t/please-help-with-the-search-for/10500/4 "2017-07-06T02:53:25Z")

</div>


