# Indexing hierarchical structures

**URL:** <https://discuss.elastic.co/t/indexing-hierarchical-structures/6631>\
**Category:** Elasticsearch\
**Created:** [February 8, 2012, 7:46am UTC](https://discuss.elastic.co/t/indexing-hierarchical-structures/6631 "2012-02-08T07:46:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yuriy\_Vasilyev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuriy_vasilyev/32/2854_2.png) [@Yuriy\_Vasilyev](https://discuss.elastic.co/u/Yuriy_Vasilyev)\
**Post date:** [February 8, 2012, 7:46am UTC](https://discuss.elastic.co/t/indexing-hierarchical-structures/6631/1 "2012-02-08T07:46:07Z")

</div>

Hi,

I'm searching on data that consists from City, Street and Address.  
If I make plain structure and store all in one index

long CityId;  
string City; // London  
long StreetId;  
string Street; // Baker street 221b  
long AddressId;  
string Address; // 221b  
string SearchString; // London, Baker street, 221b

But I also need to update index.  
The problem is to update City if there is a mistake (for instance). I  
need to update 1 million records.

Is it possible to make search friendly structure, that must not  
require to update all records, but to update only reference to City  
(Street)?

Now I search using in combination with prefix search on some  
particular fields

var query = @"""fuzzy\_like\_this"": {  
""fields"" : [""city"",  
""street"", ""address"", ""building"", ""searchString""],  
""like\_text"":""" + searchQuery +  
@""",  
""percent\_terms\_to\_match"":0.85,  
""min\_term\_freq"" : 0,  
""prefix\_length"" : 0,  
""min\_similarity"" : 0.85,  
""ignore\_tf"" : true

```
                         }";

```

Thanks

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [February 8, 2012, 1:06pm UTC](https://discuss.elastic.co/t/indexing-hierarchical-structures/6631/2 "2012-02-08T13:06:07Z")

</div>

> Is it possible to make search friendly structure, that must not  
> require to update all records, but to update only reference to City  
> (Street)?

No, there isn't although there is this server side feature:

> **[GitHub - medcl/elasticsearch-partialupdate: an elasticsearch plugin that...](https://github.com/medcl/elasticsearch-partialupdate)**
>
> an elasticsearch plugin that allows to update a specify fileds of a document,avoid full reindex and reduce traffic costs - GitHub - medcl/elasticsearch-partialupdate: an elasticsearch plugin that ...

Peter.

---

<div class="post-metadata">

**Author:** ![Yuriy\_Vasilyev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuriy_vasilyev/32/2854_2.png) [@Yuriy\_Vasilyev](https://discuss.elastic.co/u/Yuriy_Vasilyev)\
**Post date:** [February 9, 2012, 10:48am UTC](https://discuss.elastic.co/t/indexing-hierarchical-structures/6631/3 "2012-02-09T10:48:17Z")

</div>

Thanks a lot for link, it's very usefull!

Is there any best practice to organize hierarchical indexces?  
For instance is there any point to make nested document City with  
fields CityName and CityId?

Yuriy.

On 8 фев, 20:06, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:

> > Is it possible to make search friendly structure, that must not  
> > require to update all records, but to update only reference to City  
> > (Street)?
> 
> No, there isn't although there is this server side feature:
> 
> [GitHub - medcl/elasticsearch-partialupdate: an elasticsearch plugin that allows to update a specify fileds of a document,avoid full reindex and reduce traffic costs](https://github.com/medcl/elasticsearch-partialupdate)
> 
> Peter.

---

<div class="post-metadata">

**Author:** ![Nick\_Hoffman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hoffman/32/1872_2.png) [@Nick\_Hoffman](https://discuss.elastic.co/u/Nick_Hoffman)\
**Post date:** [February 11, 2012, 6:42pm UTC](https://discuss.elastic.co/t/indexing-hierarchical-structures/6631/4 "2012-02-11T18:42:20Z")

</div>

Hi Yuriy. I'm a bit confused regarding your requirements. However, a  
parent-child relationship might help you here.

---

<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, 3:39am UTC](https://discuss.elastic.co/t/indexing-hierarchical-structures/6631/5 "2017-07-06T03:39:53Z")

</div>

Closed on July 6, 2017, 3:39am UTC


