Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable aggregatable for special fields in index pattern #3284

Merged

Conversation

monicasarbu
Copy link
Contributor

@monicasarbu monicasarbu commented Jan 4, 2017

Use keyword for special fields(_index, _id, _type and _score). This depends on #3282.

Copy link
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@blacktop Can you have also a quick look?

@blacktop
Copy link

blacktop commented Jan 4, 2017

So the way I fixed it was to add this: https://github.com/blacktop/brobeat/blob/master/scripts/generate_index_pattern.py#L99

Which is over-kill as your solution is much simpler, however, the only thing that is different is that the _type field has the following set.

    meta_fields = [
        {
            "name": "_id",
            "type": "string",
            "count": 0,
            "scripted": False,
            "indexed": False,
            "analyzed": False,
            "doc_values": False,
            "searchable": False,
            "aggregatable": False,
        },
        {
            "name": "_type",
            "type": "string",
            "count": 0,
            "scripted": False,
            "indexed": False,
            "analyzed": False,
            "doc_values": False,
            "searchable": True, <===========================
            "aggregatable": True, <===========================
        },
        {
            "name": "_index",
            "type": "string",
            "count": 0,
            "scripted": False,
            "indexed": False,
            "analyzed": False,
            "doc_values": False,
            "searchable": False,
            "aggregatable": False,
        },
        {
            "name": "_score",
            "type": "number", <=======================
            "count": 0,
            "scripted": False,
            "indexed": False,
            "analyzed": False,
            "doc_values": False,
            "searchable": False,
            "aggregatable": False,
        },
    ]

NOTE: I set all the default fields in my example (which I know the python will set automatically in your solution)

Also, I think the defaults will make the meta-fields, indexed, doc_values, searchable and aggregatable all True, but Kibana makes them all False by default as can be seen above.

This can been seen in your code here - https://github.com/monicasarbu/beats/blob/53e873325a51bfaa85b78b48b2e3bf3f32538bb6/libbeat/scripts/generate_index_pattern.py#L44

    field = {
        "name": path,
        "count": 0,
        "scripted": False,
        "indexed": True, <=======================
        "analyzed": False,
        "doc_values": True, <=======================
        "searchable": True, <=======================
        "aggregatable": True, <=======================
    }

Also kibana makes _score a number and not a integer, but I am not sure that matters.

@monicasarbu monicasarbu force-pushed the fix_special_fields_index_pattern branch from e44353d to d13f064 Compare January 5, 2017 12:32
@monicasarbu monicasarbu force-pushed the fix_special_fields_index_pattern branch from 92ffd1b to a6f496a Compare January 5, 2017 12:35
@monicasarbu
Copy link
Contributor Author

monicasarbu commented Jan 5, 2017

@blacktop I have updated the PR to set the fields (_index, _id, _score and _type) with the same options as Kibana. Thanks for the detailed feedback. I am setting _score of type integer as the script changes an integer to number.

@ruflin ruflin merged commit 1785b47 into elastic:master Jan 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants