Elastic Search Hierarchical Data Need Helpp

I have a little problem with elastic search...
I have products table.which looks something like this
ID NAME MODELNAME IsParentModel
1 IPhone 7 16 gb IPhone 7 1
2 IPhone 7 32 gb IPhone 7 0
3 IPhone 7 64 gb IPhone 7 0
4 IPhone X 16 gb IPhone X 1
5 IPhone X 32 gb IPhone X 0
6 IPhone X 64 gb IPhone X 0
what i am trying to do is to get ParentProducts and then get all child products with same modelname, but problem is that i can't get more than (declared size) products.I Was trying to get Parent Modeled Products with first query and than get child queries but it is not returning all the child modeled products because by defauld it has size 10 and i don't know what to do.
I am developing elastic search on .net.This is what it looks like...

this query returns parentproducts...

var response = searchDescriptor.Size(50)
    .Index("products")
    .Query(q => q
        .Terms(c => c
            .Field("categories.id")
            .Terms(categoryIds)
        )
    )
    .Query(z => z
        .Bool(b => b
            .Should(sh => sh
                .Term(tt => tt.IsParent, true)
            )
        )
    );

//Get ReturnedProducts ModelNames

var sameModeledIds = _client.Search(searchDescriptor)
    .Hits.Select(x => x.Source.ModelName).ToList();

and than i have Method to get all the children samemodelnamedProducts

var modelNamedProductIds = FilteredModelNames(sameModeledIds);

For returning childrens Method Looks Like this...

private int[] FilteredModelNames(IList modelIds)
{
var ressp = searchDescriptor
    .Size(I dont need size i need to select all mathed data :((()
    .Index("onoff-products-tests-main")
    .Query(q => q
        .Terms(c => c
            .Field(x => x.ModelName.Suffix("keyword"))
            .Terms(modelIds)
        )
    )
    .Query(z => z
        .Bool(b => b
            .Should(sh => sh.Term(tt => tt.IsParent, true))
        )
    );
       
 var resp = _client.Search<ElasticProductOverviewModel>(searchDescriptor)
            .Hits.Select(x => int.Parse(x.Id)).ToArray();

return resp;

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel to be able to see what your question looks like. I've formatted your question this time, but please take the time to format it properly in the future.

Can you please provide the index mappings, and some data and C# POCOs/types to work with?

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