Head shows incorrect docs count if nested type field is defined in mapping

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Head shows incorrect docs count if nested type field is defined in mapping

Xudong You
I was confused by the docs count value displaying in head plugin if there is nest type field define in mapping

For example, I created a new index with following mapping:
{
    "mappings" : {
        "doc" : {
            "properties" : {
                "QueryClicks" : {
                    "type" : "nested",
                    "properties" : {
                        "Count" : {
                            "type" : "long"
                        },
                        "Term" : {
                            "type" : "string"
                        }
                    }
                },
                "Title" : {
                    "type" : "string"
                }
            }
        }
    }
}

And then insert ONE doc:
{
  "QueryClicks":[{"Term":"term1","Count":10},{"Term":"term2","Count":10}],
  "Title":"test title"
}

Then refresh Head, the docs shown on Head is 3:
size: 3.57ki (6.97ki)
docs: 3 (3)

Why?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f3148390-9174-4521-b97a-94f6cbfe4307%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Head shows incorrect docs count if nested type field is defined in mapping

Xudong You
BTW: If I just remove the "type":"nested" from the mapping, the doc count then is correct after insert one document.
Anyone has suggestions resolve this issue?

On Thursday, April 16, 2015 at 5:36:04 PM UTC+8, Xudong You wrote:
I was confused by the docs count value displaying in head plugin if there is nest type field define in mapping

For example, I created a new index with following mapping:
{
    "mappings" : {
        "doc" : {
            "properties" : {
                "QueryClicks" : {
                    "type" : "nested",
                    "properties" : {
                        "Count" : {
                            "type" : "long"
                        },
                        "Term" : {
                            "type" : "string"
                        }
                    }
                },
                "Title" : {
                    "type" : "string"
                }
            }
        }
    }
}

And then insert ONE doc:
{
  "QueryClicks":[{"Term":"term1","Count":10},{"Term":"term2","Count":10}],
  "Title":"test title"
}

Then refresh Head, the docs shown on Head is 3:
size: 3.57ki (6.97ki)
docs: 3 (3)

Why?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6173334c-dbc6-46f7-b191-5c2f92421392%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Head shows incorrect docs count if nested type field is defined in mapping

Xudong You
In reply to this post by Xudong You
Just figured out that the doc count is actually the number of document + the number of items of nested field, in my case, the QueryClicks field has two items, then the total number of doc shown on head is 1+2=3.
But this might confuse the people who view doc counts on head or other UI plug-in.

Is there anyway let head just show the doc count, regarding if the doc has nested field or not.


On Thursday, April 16, 2015 at 5:36:04 PM UTC+8, Xudong You wrote:
I was confused by the docs count value displaying in head plugin if there is nest type field define in mapping

For example, I created a new index with following mapping:
{
    "mappings" : {
        "doc" : {
            "properties" : {
                "QueryClicks" : {
                    "type" : "nested",
                    "properties" : {
                        "Count" : {
                            "type" : "long"
                        },
                        "Term" : {
                            "type" : "string"
                        }
                    }
                },
                "Title" : {
                    "type" : "string"
                }
            }
        }
    }
}

And then insert ONE doc:
{
  "QueryClicks":[{"Term":"term1","Count":10},{"Term":"term2","Count":10}],
  "Title":"test title"
}

Then refresh Head, the docs shown on Head is 3:
size: 3.57ki (6.97ki)
docs: 3 (3)

Why?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b6dc87e7-f242-40f9-9ab0-d98c0c08e2c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Head shows incorrect docs count if nested type field is defined in mapping

Glen Smith
Go to the "browser" tab and select the type. That will show the count you are looking for.



On Thursday, April 16, 2015 at 10:44:29 PM UTC-4, Xudong You wrote:
Just figured out that the doc count is actually the number of document + the number of items of nested field, in my case, the QueryClicks field has two items, then the total number of doc shown on head is 1+2=3.
But this might confuse the people who view doc counts on head or other UI plug-in.

Is there anyway let head just show the doc count, regarding if the doc has nested field or not.


On Thursday, April 16, 2015 at 5:36:04 PM UTC+8, Xudong You wrote:
I was confused by the docs count value displaying in head plugin if there is nest type field define in mapping

For example, I created a new index with following mapping:
{
    "mappings" : {
        "doc" : {
            "properties" : {
                "QueryClicks" : {
                    "type" : "nested",
                    "properties" : {
                        "Count" : {
                            "type" : "long"
                        },
                        "Term" : {
                            "type" : "string"
                        }
                    }
                },
                "Title" : {
                    "type" : "string"
                }
            }
        }
    }
}

And then insert ONE doc:
{
  "QueryClicks":[{"Term":"term1","Count":10},{"Term":"term2","Count":10}],
  "Title":"test title"
}

Then refresh Head, the docs shown on Head is 3:
size: 3.57ki (6.97ki)
docs: 3 (3)

Why?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bf13dc04-a9c7-4cd4-9136-a9f8fcf1567f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Head shows incorrect docs count if nested type field is defined in mapping

Xudong You
Thanks Glen!

On Friday, April 17, 2015 at 11:14:36 AM UTC+8, Glen Smith wrote:
Go to the "browser" tab and select the type. That will show the count you are looking for.



On Thursday, April 16, 2015 at 10:44:29 PM UTC-4, Xudong You wrote:
Just figured out that the doc count is actually the number of document + the number of items of nested field, in my case, the QueryClicks field has two items, then the total number of doc shown on head is 1+2=3.
But this might confuse the people who view doc counts on head or other UI plug-in.

Is there anyway let head just show the doc count, regarding if the doc has nested field or not.


On Thursday, April 16, 2015 at 5:36:04 PM UTC+8, Xudong You wrote:
I was confused by the docs count value displaying in head plugin if there is nest type field define in mapping

For example, I created a new index with following mapping:
{
    "mappings" : {
        "doc" : {
            "properties" : {
                "QueryClicks" : {
                    "type" : "nested",
                    "properties" : {
                        "Count" : {
                            "type" : "long"
                        },
                        "Term" : {
                            "type" : "string"
                        }
                    }
                },
                "Title" : {
                    "type" : "string"
                }
            }
        }
    }
}

And then insert ONE doc:
{
  "QueryClicks":[{"Term":"term1","Count":10},{"Term":"term2","Count":10}],
  "Title":"test title"
}

Then refresh Head, the docs shown on Head is 3:
size: 3.57ki (6.97ki)
docs: 3 (3)

Why?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c6512d9d-b4ff-49ca-b255-c934cfba146b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.