class TestIntegrationAnalyzers(ElasticsearchTestCase): """Test the custom analyzers we create in our indices""" def setup_method(self, method): super().setup_method(method) config = self.get_base_config(cls=SuperSearchWithFields) self.api = SuperSearchWithFields(config=config) self.now = datetimeutil.utc_now() def test_semicolon_keywords(self): """Test the analyzer called `semicolon_keywords`. That analyzer creates tokens (terms) by splitting the input on semicolons (;) only. """ self.index_crash( processed_crash={"date_processed": self.now}, raw_crash={"AppInitDLLs": "/path/to/dll;;foo;C:\\bar\\boo"}, ) self.index_crash( processed_crash={"date_processed": self.now}, raw_crash={"AppInitDLLs": "/path/to/dll;D:\\bar\\boo"}, ) self.es_context.refresh() res = self.api.get(app_init_dlls="/path/to/dll", _facets=["app_init_dlls"]) assert res["total"] == 2 assert "app_init_dlls" in res["facets"] facet_terms = [x["term"] for x in res["facets"]["app_init_dlls"]] assert "/path/to/dll" in facet_terms assert "c:\\bar\\boo" in facet_terms assert "foo" in facet_terms
class IntegrationTestAnalyzers(ElasticsearchTestCase): """Test the custom analyzers we create in our indices. """ def setUp(self): super(IntegrationTestAnalyzers, self).setUp() self.api = SuperSearchWithFields(config=self.config) self.now = datetimeutil.utc_now() @minimum_es_version('1.0') def test_semicolon_keywords(self): """Test the analyzer called `semicolon_keywords`. That analyzer creates tokens (terms) by splitting the input on semicolons (;) only. """ self.index_crash({ 'date_processed': self.now, 'app_init_dlls': '/path/to/dll;;foo;C:\\bar\\boo', }) self.index_crash({ 'date_processed': self.now, 'app_init_dlls': '/path/to/dll;D:\\bar\\boo', }) self.refresh_index() res = self.api.get( app_init_dlls='/path/to/dll', _facets=['app_init_dlls'], ) assert res['total'] == 2 assert 'app_init_dlls' in res['facets'] facet_terms = [x['term'] for x in res['facets']['app_init_dlls']] assert '/path/to/dll' in facet_terms assert 'c:\\bar\\boo' in facet_terms assert 'foo' in facet_terms
class TestIntegrationAnalyzers(ElasticsearchTestCase): """Test the custom analyzers we create in our indices""" def setup_method(self, method): super().setup_method(method) config = self.get_base_config(cls=SuperSearchWithFields) self.api = SuperSearchWithFields(config=config) self.now = datetimeutil.utc_now() def test_semicolon_keywords(self): """Test the analyzer called `semicolon_keywords`. That analyzer creates tokens (terms) by splitting the input on semicolons (;) only. """ self.index_crash( processed_crash={ 'date_processed': self.now, }, raw_crash={ 'AppInitDLLs': '/path/to/dll;;foo;C:\\bar\\boo', } ) self.index_crash( processed_crash={ 'date_processed': self.now, }, raw_crash={ 'AppInitDLLs': '/path/to/dll;D:\\bar\\boo', } ) self.es_context.refresh() res = self.api.get( app_init_dlls='/path/to/dll', _facets=['app_init_dlls'], ) assert res['total'] == 2 assert 'app_init_dlls' in res['facets'] facet_terms = [x['term'] for x in res['facets']['app_init_dlls']] assert '/path/to/dll' in facet_terms assert 'c:\\bar\\boo' in facet_terms assert 'foo' in facet_terms
class TestIntegrationAnalyzers(ElasticsearchTestCase): """Test the custom analyzers we create in our indices""" def setup_method(self, method): super().setup_method(method) config = self.get_base_config(cls=SuperSearchWithFields) self.api = SuperSearchWithFields(config=config) self.now = datetimeutil.utc_now() def test_semicolon_keywords(self): """Test the analyzer called `semicolon_keywords`. That analyzer creates tokens (terms) by splitting the input on semicolons (;) only. """ self.index_crash( processed_crash={ 'date_processed': self.now, }, raw_crash={ 'AppInitDLLs': '/path/to/dll;;foo;C:\\bar\\boo', } ) self.index_crash( processed_crash={ 'date_processed': self.now, }, raw_crash={ 'AppInitDLLs': '/path/to/dll;D:\\bar\\boo', } ) self.refresh_index() res = self.api.get( app_init_dlls='/path/to/dll', _facets=['app_init_dlls'], ) assert res['total'] == 2 assert 'app_init_dlls' in res['facets'] facet_terms = [x['term'] for x in res['facets']['app_init_dlls']] assert '/path/to/dll' in facet_terms assert 'c:\\bar\\boo' in facet_terms assert 'foo' in facet_terms
class IntegrationTestAnalyzers(ElasticsearchTestCase): """Test the custom analyzers we create in our indices. """ def setUp(self): super(IntegrationTestAnalyzers, self).setUp() self.api = SuperSearchWithFields(config=self.config) self.now = datetimeutil.utc_now() @minimum_es_version('1.0') def test_semicolon_keywords(self): """Test the analyzer called `semicolon_keywords`. That analyzer creates tokens (terms) by splitting the input on semicolons (;) only. """ self.index_crash({ 'date_processed': self.now, 'app_init_dlls': '/path/to/dll;;foo;C:\\bar\\boo', }) self.index_crash({ 'date_processed': self.now, 'app_init_dlls': '/path/to/dll;D:\\bar\\boo', }) self.refresh_index() res = self.api.get( app_init_dlls='/path/to/dll', _facets=['app_init_dlls'], ) eq_(res['total'], 2) ok_('app_init_dlls' in res['facets']) facet_terms = [x['term'] for x in res['facets']['app_init_dlls']] ok_('/path/to/dll' in facet_terms) ok_('c:\\bar\\boo' in facet_terms) ok_('foo' in facet_terms)
def setup_method(self, method): super().setup_method(method) config = self.get_base_config(cls=SuperSearchWithFields) self.api = SuperSearchWithFields(config=config) self.now = datetimeutil.utc_now()
def setup_method(self, method): super().setup_method(method) config = self.get_base_config(cls=SuperSearchWithFields) self.api = SuperSearchWithFields(config=config) self.now = datetimeutil.utc_now()
def setUp(self): super(IntegrationTestAnalyzers, self).setUp() self.api = SuperSearchWithFields(config=self.config) self.now = datetimeutil.utc_now()
def setUp(self): super(IntegrationTestAnalyzers, self).setUp() self.api = SuperSearchWithFields(config=self.config) self.now = datetimeutil.utc_now()