Hi,
I am new to ElasticSearch, and I'm trying to find out if ES is able to
count root documents instead of the nested documents when i'm using nested
query facets.
Here is my index mapping (NEST code)
[ElasticType(
Name = "productgroup",
DateDetection = true,
NumericDetection = true,
SearchAnalyzer = "standard",
IndexAnalyzer = "standard",
DynamicDateFormats = new[] { "dateOptionalTime", "yyyy/MM/dd HH:mm:ss
Z||yyyy/MM/dd Z" }
)]
public class ProductGroup {
public long GID { get; set; }
[ElasticProperty(Type = FieldType.nested)]
public NestedProducts[] Products { get; set; }
}
public class NestedProducts
{
public long PID { get; set; }
[ElasticProperty(Index = FieldIndexOption.not_analyzed, OmitNorms =
true)]
public short FolderID { get; set; }
}
Here is the dummy data:
NestedProducts[] npg0 = new NestedProducts[3];
npg0[0] = new NestedProducts() { PID = 1241255, ProductType = "a", FolderID
= 1 };
npg0[1] = new NestedProducts() { PID = 4365123, ProductType = "a", FolderID
= 2 };
npg0[2] = new NestedProducts() { PID = 6425645, ProductType = "b", FolderID
= 1 };
ProductGroup pg0 = new ProductGroup { GID = 2151076, StoreID = 1125098,
Products = npg0 };
client.Index(pg0);
Here is my HTTP get JSON query:
curl -XGET 'http://localhost:9200/product_index/_search?pretty=true' -d '
{
"query": {
"match_all": {}
},
"facets": {
"facet1": {
"terms": {
"field" : "folderID"
},
"facet_filter" : {
"term" : {"folderID" : 1}
},
"nested": "products"
}
}
}'
This returns a count of the nested documents, i.e. 2.
What I want is to get the count of the root document, i.e. 1.
I have tried various methods, including trying to apply the JOIN keyword
(https://github.com/elasticsearch/elasticsearch/issues/2606), but to no
avail.
Would greatly appreciate any assistance or pointers! Thanks.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.