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

Construct the significant terms aggregation builder's parser statically #25519

Closed
nik9000 opened this issue Jul 3, 2017 · 3 comments · Fixed by #50623
Closed

Construct the significant terms aggregation builder's parser statically #25519

nik9000 opened this issue Jul 3, 2017 · 3 comments · Fixed by #50623
Assignees

Comments

@nik9000
Copy link
Member

nik9000 commented Jul 3, 2017

Right now we build a new ObjectParser every time we want get a significant terms aggregation. We do this because we had to pass in ParseFieldRegistry<SignificanceHeuristicParser>. I think we can avoid this by moving ParseFieldRegistry<SignificanceHeuristicParser> to NamedXContentRegistry style parsing.

@nik9000 nik9000 added :Analytics/Aggregations Aggregations help wanted adoptme good first issue low hanging fruit labels Jul 3, 2017
@nik9000
Copy link
Member Author

nik9000 commented Jul 3, 2017

Marked a low hanging fruit because it should be fairly simple to do but big enough that it certainly deserves its own PR.

@cbuescher
Copy link
Member

Same is true for SignificantTextAggregationBuilder which follows the same pattern. I took a quick first look at it, changing the way the heuristics are registered is only part of this. I quickly got stuck when trying to convert the part around

because currently each potential heuristic is declared on the ObjectParser using its name. I think we might need something like what I started in #24020 to be able to do this with ObjectParser, most other places we parse named things like this we still do it in the "classic" manual parsing style. Just adding this note here since this issue might be a little more involved than estimated.

@nik9000 nik9000 removed the good first issue low hanging fruit label Jul 3, 2017
@colings86
Copy link
Contributor

@elastic/es-search-aggs

@nik9000 nik9000 self-assigned this Dec 23, 2019
@nik9000 nik9000 removed the help wanted adoptme label Dec 23, 2019
nik9000 added a commit to nik9000/elasticsearch that referenced this issue Jan 2, 2020
This adds support for "collapsed" named object to `ObjectParser`. In
particular, this supports the sort of xcontent that we use to specify
significance heuristics. See elastic#25519 and this example:

```
GET /_search
{
    "query" : {
        "terms" : {"force" : [ "British Transport Police" ]}
    },
    "aggregations" : {
        "significant_crime_types" : {
            "significant_terms" : {
                "field" : "crime_type",
                "mutual_information" : { <<------- This is the name
                    "include_negatives": true
                }
            }
        }
    }
}
```

I believe there are a couple of things that work this way.

I've held off on moving the actual parsing of the significant heuristics
to this code to kep the review more compact. The moving is pretty
mechanical stuff in the aggs framework.
nik9000 added a commit that referenced this issue Jan 3, 2020
This adds support for "collapsed" named object to `ObjectParser`. In
particular, this supports the sort of xcontent that we use to specify
significance heuristics. See #25519 and this example:

```
GET /_search
{
    "query" : {
        "terms" : {"force" : [ "British Transport Police" ]}
    },
    "aggregations" : {
        "significant_crime_types" : {
            "significant_terms" : {
                "field" : "crime_type",
                "mutual_information" : { <<------- This is the name
                    "include_negatives": true
                }
            }
        }
    }
}
```

I believe there are a couple of things that work this way.

I've held off on moving the actual parsing of the significant heuristics
to this code to keep the review more compact. The moving is pretty
mechanical stuff in the aggs framework.
nik9000 added a commit to nik9000/elasticsearch that referenced this issue Jan 3, 2020
This adds support for "collapsed" named object to `ObjectParser`. In
particular, this supports the sort of xcontent that we use to specify
significance heuristics. See elastic#25519 and this example:

```
GET /_search
{
    "query" : {
        "terms" : {"force" : [ "British Transport Police" ]}
    },
    "aggregations" : {
        "significant_crime_types" : {
            "significant_terms" : {
                "field" : "crime_type",
                "mutual_information" : { <<------- This is the name
                    "include_negatives": true
                }
            }
        }
    }
}
```

I believe there are a couple of things that work this way.

I've held off on moving the actual parsing of the significant heuristics
to this code to keep the review more compact. The moving is pretty
mechanical stuff in the aggs framework.
nik9000 added a commit to nik9000/elasticsearch that referenced this issue Jan 3, 2020
This replaces the hand written xcontent parsers for significance
heristics with `ObjectParser` and parsing named xcontent.

As a happy accident, this was the last user of `ParseFieldRegistry` so
this PR entirely removes that class.

Closes elastic#25519
nik9000 added a commit that referenced this issue Jan 3, 2020
This adds support for "collapsed" named object to `ObjectParser`. In
particular, this supports the sort of xcontent that we use to specify
significance heuristics. See #25519 and this example:

```
GET /_search
{
    "query" : {
        "terms" : {"force" : [ "British Transport Police" ]}
    },
    "aggregations" : {
        "significant_crime_types" : {
            "significant_terms" : {
                "field" : "crime_type",
                "mutual_information" : { <<------- This is the name
                    "include_negatives": true
                }
            }
        }
    }
}
```

I believe there are a couple of things that work this way.

I've held off on moving the actual parsing of the significant heuristics
to this code to keep the review more compact. The moving is pretty
mechanical stuff in the aggs framework.
nik9000 added a commit that referenced this issue Jan 6, 2020
This replaces the hand written xcontent parsers for significance
heristics with `ObjectParser` and parsing named xcontent.

As a happy accident, this was the last user of `ParseFieldRegistry` so
this PR entirely removes that class.

Closes #25519
nik9000 added a commit to nik9000/elasticsearch that referenced this issue Jan 6, 2020
This replaces the hand written xcontent parsers for significance
heristics with `ObjectParser` and parsing named xcontent.

As a happy accident, this was the last user of `ParseFieldRegistry` so
this PR entirely removes that class.

Closes elastic#25519
nik9000 added a commit that referenced this issue Jan 6, 2020
This replaces the hand written xcontent parsers for significance
heristics with `ObjectParser` and parsing named xcontent.

As a happy accident, this was the last user of `ParseFieldRegistry` so
this PR entirely removes that class.

Closes #25519
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this issue Jan 23, 2020
This adds support for "collapsed" named object to `ObjectParser`. In
particular, this supports the sort of xcontent that we use to specify
significance heuristics. See elastic#25519 and this example:

```
GET /_search
{
    "query" : {
        "terms" : {"force" : [ "British Transport Police" ]}
    },
    "aggregations" : {
        "significant_crime_types" : {
            "significant_terms" : {
                "field" : "crime_type",
                "mutual_information" : { <<------- This is the name
                    "include_negatives": true
                }
            }
        }
    }
}
```

I believe there are a couple of things that work this way.

I've held off on moving the actual parsing of the significant heuristics
to this code to keep the review more compact. The moving is pretty
mechanical stuff in the aggs framework.
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this issue Jan 23, 2020
This replaces the hand written xcontent parsers for significance
heristics with `ObjectParser` and parsing named xcontent.

As a happy accident, this was the last user of `ParseFieldRegistry` so
this PR entirely removes that class.

Closes elastic#25519
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants