Elasticsearch facet count problem in subdocuments

Hi,

I have a faceted search for sub document but it returns wrong count. I have
2 match subdocuments but it counts as 1. You can see an example gist here
https://gist.github.com/4015950 .

Thanks in advance

--

Facets agreggates data based on search results. Counts are provided at
document level (here is my/terms). In your sample, 1 document among all
the results has the field translation.lang with the value "tr".

If you were expecting a count value of 2, you should split your document
into parent (terms)/child (translations) documents and running faceted
search on child documents.

-- Tanguy

Le lundi 5 novembre 2012 09:11:19 UTC+1, Hüseyin BABAL a écrit :

Hi,

I have a faceted search for sub document but it returns wrong count. I
have 2 match subdocuments but it counts as 1. You can see an example gist
here Elasticsearch subdocument facet count · GitHub .

Thanks in advance

--

I have used nested document and it has dangerous to change nested to
parent&child in my application. I put nested documents directly to the page
view. It would be better if facet search on nested documents is available,
i will try to find another way to solve my problem.

Thanks

On Mon, Nov 5, 2012 at 10:32 AM, Tanguy tlrx.dev@gmail.com wrote:

Facets agreggates data based on search results. Counts are provided at
document level (here is my/terms). In your sample, 1 document among all
the results has the field translation.lang with the value "tr".

If you were expecting a count value of 2, you should split your document
into parent (terms)/child (translations) documents and running faceted
search on child documents.

-- Tanguy

Le lundi 5 novembre 2012 09:11:19 UTC+1, Hüseyin BABAL a écrit :

Hi,

I have a faceted search for sub document but it returns wrong count. I
have 2 match subdocuments but it counts as 1. You can see an example gist
here https://gist.github.com/**4015950 https://gist.github.com/4015950
.

Thanks in advance

--

--

Facet search on nested documents
is available Elasticsearch Platform — Find real-time answers at scale | Elastic

On Monday, November 5, 2012 7:58:46 AM UTC-5, Hüseyin BABAL wrote:

I have used nested document and it has dangerous to change nested to
parent&child in my application. I put nested documents directly to the page
view. It would be better if facet search on nested documents is available,
i will try to find another way to solve my problem.

Thanks

On Mon, Nov 5, 2012 at 10:32 AM, Tanguy <tlrx...@gmail.com <javascript:>>wrote:

Facets agreggates data based on search results. Counts are provided at
document level (here is my/terms). In your sample, 1 document among all
the results has the field translation.lang with the value "tr".

If you were expecting a count value of 2, you should split your document
into parent (terms)/child (translations) documents and running faceted
search on child documents.

-- Tanguy

Le lundi 5 novembre 2012 09:11:19 UTC+1, Hüseyin BABAL a écrit :

Hi,

I have a faceted search for sub document but it returns wrong count. I
have 2 match subdocuments but it counts as 1. You can see an example gist
here https://gist.github.com/**4015950 https://gist.github.com/4015950
.

Thanks in advance

--

--

Thanks Igor, i have already saw that documentation but couldn't manage to
construct query according to that document. I want to make facet search on
nested documents' one field called "lang" but in docs it is like;

"facets": {
"facet1": {
"terms_stats": {
"key_field": "obj1.name",
"value_field": "obj1.count"
},
"scope": "my_scope"
}
}

my current query is like this here Elasticsearch subdocument facet count · GitHub
.However it returns per document facet count not nested documents count.

On Mon, Nov 5, 2012 at 11:35 PM, Igor Motov imotov@gmail.com wrote:

Facet search on nested documents is available
Elasticsearch Platform — Find real-time answers at scale | Elastic

On Monday, November 5, 2012 7:58:46 AM UTC-5, Hüseyin BABAL wrote:

I have used nested document and it has dangerous to change nested to
parent&child in my application. I put nested documents directly to the page
view. It would be better if facet search on nested documents is available,
i will try to find another way to solve my problem.

Thanks

On Mon, Nov 5, 2012 at 10:32 AM, Tanguy tlrx...@gmail.com wrote:

Facets agreggates data based on search results. Counts are provided at
document level (here is my/terms). In your sample, 1 document among all
the results has the field translation.lang with the value "tr".

If you were expecting a count value of 2, you should split your document
into parent (terms)/child (translations) documents and running faceted
search on child documents.

-- Tanguy

Le lundi 5 novembre 2012 09:11:19 UTC+1, Hüseyin BABAL a écrit :

Hi,

I have a faceted search for sub document but it returns wrong count. I
have 2 match subdocuments but it counts as 1. You can see an example gist
here https://gist.github.com/**4**015950https://gist.github.com/4015950
.

Thanks in advance

--

--

--

That facet runs on the parent documents and the fact that it works, might
indicate one of two things: your translation documents are not mapped as
nested or you have include_in_parent flag turned on. The nested facet
should look like this:

curl -XPOST http://localhost:9200/my/terms/_search?pretty=true -d '
{
"query" : { "wildcard" : {"term" : "fire"} },
"facets" : {
"langs" : {
"terms" : {"field" : "translations.lang"},
"nested": "translations"
}
}
}
'

On Tuesday, November 6, 2012 1:35:51 AM UTC-5, Hüseyin BABAL wrote:

Thanks Igor, i have already saw that documentation but couldn't manage to
construct query according to that document. I want to make facet search on
nested documents' one field called "lang" but in docs it is like;

"facets": {
"facet1": {
"terms_stats": {
"key_field": "obj1.name",
"value_field": "obj1.count"
},
"scope": "my_scope"
}
}

my current query is like this here Elasticsearch subdocument facet count · GitHub
.However it returns per document facet count not nested documents count.

On Mon, Nov 5, 2012 at 11:35 PM, Igor Motov <imo...@gmail.com<javascript:>

wrote:

Facet search on nested documents is available
Elasticsearch Platform — Find real-time answers at scale | Elastic

On Monday, November 5, 2012 7:58:46 AM UTC-5, Hüseyin BABAL wrote:

I have used nested document and it has dangerous to change nested to
parent&child in my application. I put nested documents directly to the page
view. It would be better if facet search on nested documents is available,
i will try to find another way to solve my problem.

Thanks

On Mon, Nov 5, 2012 at 10:32 AM, Tanguy tlrx...@gmail.com wrote:

Facets agreggates data based on search results. Counts are provided at
document level (here is my/terms). In your sample, 1 document among all
the results has the field translation.lang with the value "tr".

If you were expecting a count value of 2, you should split your
document into parent (terms)/child (translations) documents and running
faceted search on child documents.

-- Tanguy

Le lundi 5 novembre 2012 09:11:19 UTC+1, Hüseyin BABAL a écrit :

Hi,

I have a faceted search for sub document but it returns wrong count. I
have 2 match subdocuments but it counts as 1. You can see an example gist
here https://gist.github.com/**4**015950https://gist.github.com/4015950
.

Thanks in advance

--

--

--

Hi Igor,

Currently my document is nested but i haven't mapped as nested type
explicitly, i got error when i used your query above. However, i have
configured the mapping for nested type and it works.

Thank you

On Tue, Nov 6, 2012 at 1:13 PM, Igor Motov imotov@gmail.com wrote:

That facet runs on the parent documents and the fact that it works, might
indicate one of two things: your translation documents are not mapped as
nested or you have include_in_parent flag turned on. The nested facet should
look like this:

curl -XPOST http://localhost:9200/my/terms/_search?pretty=true -d '
{
"query" : { "wildcard" : {"term" : "fire"} },
"facets" : {
"langs" : {
"terms" : {"field" : "translations.lang"},
"nested": "translations"
}
}
}
'

On Tuesday, November 6, 2012 1:35:51 AM UTC-5, Hüseyin BABAL wrote:

Thanks Igor, i have already saw that documentation but couldn't manage to
construct query according to that document. I want to make facet search on
nested documents' one field called "lang" but in docs it is like;

"facets": {
"facet1": {
"terms_stats": {
"key_field": "obj1.name",
"value_field": "obj1.count"
},
"scope": "my_scope"
}
}

my current query is like this here Elasticsearch subdocument facet count · GitHub
.However it returns per document facet count not nested documents count.

On Mon, Nov 5, 2012 at 11:35 PM, Igor Motov imo...@gmail.com wrote:

Facet search on nested documents is available
Elasticsearch Platform — Find real-time answers at scale | Elastic

On Monday, November 5, 2012 7:58:46 AM UTC-5, Hüseyin BABAL wrote:

I have used nested document and it has dangerous to change nested to
parent&child in my application. I put nested documents directly to the page
view. It would be better if facet search on nested documents is available, i
will try to find another way to solve my problem.

Thanks

On Mon, Nov 5, 2012 at 10:32 AM, Tanguy tlrx...@gmail.com wrote:

Facets agreggates data based on search results. Counts are provided at
document level (here is my/terms). In your sample, 1 document among all the
results has the field translation.lang with the value "tr".

If you were expecting a count value of 2, you should split your
document into parent (terms)/child (translations) documents and running
faceted search on child documents.

-- Tanguy

Le lundi 5 novembre 2012 09:11:19 UTC+1, Hüseyin BABAL a écrit :

Hi,

I have a faceted search for sub document but it returns wrong count. I
have 2 match subdocuments but it counts as 1. You can see an example gist
here Elasticsearch subdocument facet count · GitHub .

Thanks in advance

--

--

--

--