def METHOD_NAME() -> Plugin:
    return Plugin(
        start=False,
        spec=Spec(
            module=__name__,
            className='CountRecordsAction',
            inputs=["payload"],
            outputs=["result", "error"],
            version='0.6.2',
            license="MIT",
            author="Dawid Kruk",
            manual="count_by_query_string_action",
            init={
                "index": None,
                "time_range": None,
                "query": ""
            },
            form=Form(
                groups=[
                    FormGroup(
                        name="Plugin configuration",
                        fields=[
                            FormField(
                                id="index",
                                name="Index",
                                description="Please select the index that you want to search for matches.",
                                component=FormComponent(type="select", props={"label": "Index", "items": {
                                    "event": "Event",
                                    "profile": "Profile",
                                    "session": "Session"
                                }})
                            ),
                            FormField(
                                id="time_range",
                                name="Time range",
                                description="Please define the time range from now that you want to search within "
                                            "(e.g. -30d).",
                                component=FormComponent(type="text", props={"label": "Time range"})
                            ),
                            FormField(
                                id="query",
                                name="Query string",
                                description="Please provide a query string that will match records to be counted. "
                                            "(e.g. type:\"page-view\"). You can use dot template as well.",
                                component=FormComponent(type="textarea", props={"label": "Query"})
                            ),
                        ]
                    )
                ]
            )
        ),
        metadata=MetaData(
            name='Count records',
            desc='Counts event, profile, or session records.Records can be filtered by query sting.',
            icon='plugin',
            group=["Stats"],
            purpose=['collection', 'segmentation'],
            documentation=Documentation(
                inputs={
                    "payload": PortDoc(desc="This port takes payload object.")
                },
                outputs={
                    "result": PortDoc(desc="This port returns number of records."),
                    "error": PortDoc(desc="This port returns error info if something goes wrong.")
                }
            )
        )
    )