I have a document with multivalue fields:
_mapping_index3.json
properties: {
id: {
type: string
},
name: {
type: string
},
bought_together: {
dynamic: true,
properties: {
This file has been truncated. show original
_mapping_index4.json
dummy_index_4: {
sale: {
properties: {
bought_together: {
type: nested
properties: {
id: {
type: string
}
name: {
This file has been truncated. show original
document.json
{
id: 6,
name: Bread,
bought_together: [
{
id: 7,
name: Cheese
},
{
id: 8,
This file has been truncated. show original
There are more than three files. show original
But when I run a facet query on it:
_mapping_index3.json
properties: {
id: {
type: string
},
name: {
type: string
},
bought_together: {
dynamic: true,
properties: {
This file has been truncated. show original
_mapping_index4.json
dummy_index_4: {
sale: {
properties: {
bought_together: {
type: nested
properties: {
id: {
type: string
}
name: {
This file has been truncated. show original
document.json
{
id: 6,
name: Bread,
bought_together: [
{
id: 7,
name: Cheese
},
{
id: 8,
This file has been truncated. show original
There are more than three files. show original
Each term value returns a total count of 1, even though the count should be
more than that:
_mapping_index3.json
properties: {
id: {
type: string
},
name: {
type: string
},
bought_together: {
dynamic: true,
properties: {
This file has been truncated. show original
_mapping_index4.json
dummy_index_4: {
sale: {
properties: {
bought_together: {
type: nested
properties: {
id: {
type: string
}
name: {
This file has been truncated. show original
document.json
{
id: 6,
name: Bread,
bought_together: [
{
id: 7,
name: Cheese
},
{
id: 8,
This file has been truncated. show original
There are more than three files. show original
What's the right way to setup the document data or mappings in order to
measure the count of the term facets accurately?
https://gist.github.com/pulkitsinghal/5447250#file-_mapping-json
Perhaps its the query that needs to be tweaked?
--
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 .
dadoonet
(David Pilato)
April 23, 2013, 9:09pm
2
A TermsFacet counts the number of docs, not the number of terms per doc or field.
Perhaps, you can use a script to render it, but I'm not sure of that.
See Elasticsearch Platform — Find real-time answers at scale | Elastic
curl http://localhost:9200/index/_search?pretty -d '
{
"query" : {
"match_all" : { }
},
"script_fields" : {
"tag" : {
"script" : "doc["field_name"].values.length"
}
}
}'
--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs
Le 23 avr. 2013 à 22:58, pulkitsinghal pulkitsinghal@gmail.com a écrit :
I have a document with multivalue fields:
Multivalue field and facet query - unexpected results... · GitHub
But when I run a facet query on it:
Multivalue field and facet query - unexpected results... · GitHub
Each term value returns a total count of 1, even though the count should be more than that:
Multivalue field and facet query - unexpected results... · GitHub
What's the right way to setup the document data or mappings in order to measure the count of the term facets accurately?
Multivalue field and facet query - unexpected results... · GitHub
Perhaps its the query that needs to be tweaked?
--
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 .
On Tue, Apr 23, 2013 at 4:09 PM, David Pilato david@pilato.fr wrote:
A TermsFacet counts the number of docs, not the number of terms per doc or
field.
Ok, so I started again in a different index with the mapping set to nested:
"properties" : {
"bought_together" : {
"type" : "nested"
}
}
So I've effectively changed the mapping from:
_mapping_index3.json
properties: {
id: {
type: string
},
name: {
type: string
},
bought_together: {
dynamic: true,
properties: {
This file has been truncated. show original
_mapping_index4.json
dummy_index_4: {
sale: {
properties: {
bought_together: {
type: nested
properties: {
id: {
type: string
}
name: {
This file has been truncated. show original
document.json
{
id: 6,
name: Bread,
bought_together: [
{
id: 7,
name: Cheese
},
{
id: 8,
This file has been truncated. show original
There are more than three files. show original
to
_mapping_index3.json
properties: {
id: {
type: string
},
name: {
type: string
},
bought_together: {
dynamic: true,
properties: {
This file has been truncated. show original
_mapping_index4.json
dummy_index_4: {
sale: {
properties: {
bought_together: {
type: nested
properties: {
id: {
type: string
}
name: {
This file has been truncated. show original
document.json
{
id: 6,
name: Bread,
bought_together: [
{
id: 7,
name: Cheese
},
{
id: 8,
This file has been truncated. show original
There are more than three files. show original
Now that its indexing it as a nested document, I would expect the term
facet count to function so once again I run:
_mapping_index3.json
properties: {
id: {
type: string
},
name: {
type: string
},
bought_together: {
dynamic: true,
properties: {
This file has been truncated. show original
_mapping_index4.json
dummy_index_4: {
sale: {
properties: {
bought_together: {
type: nested
properties: {
id: {
type: string
}
name: {
This file has been truncated. show original
document.json
{
id: 6,
name: Bread,
bought_together: [
{
id: 7,
name: Cheese
},
{
id: 8,
This file has been truncated. show original
There are more than three files. show original
But there is still some gap in my understanding because I don't get any
results:
facets: {
tag: {
_type: terms
missing: 1
total: 0
other: 0
terms:
}
}
Thoughts? Tips?
--
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 .