use of org.opensearch.search.SearchModule in project OpenSearch by opensearch-project.
the class NestedSortBuilderTests method init.
@BeforeClass
public static void init() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList());
namedWriteableRegistry = new NamedWriteableRegistry(searchModule.getNamedWriteables());
xContentRegistry = new NamedXContentRegistry(searchModule.getNamedXContents());
}
use of org.opensearch.search.SearchModule in project OpenSearch by opensearch-project.
the class AggregatorTestCase method initValuesSourceRegistry.
// Make this @Before instead of @BeforeClass so it can call the non-static getSearchPlugins method
@Before
public void initValuesSourceRegistry() {
List<SearchPlugin> plugins = new ArrayList<>(getSearchPlugins());
plugins.add(new AggCardinalityPlugin());
SearchModule searchModule = new SearchModule(Settings.EMPTY, plugins);
valuesSourceRegistry = searchModule.getValuesSourceRegistry();
}
use of org.opensearch.search.SearchModule in project OpenSearch by opensearch-project.
the class InternalAggregationTestCase method getNamedWriteables.
/**
* Implementors can override this if they want to provide a custom list of namedWriteables. If the implementor
* _just_ wants to register in namedWriteables provided by a plugin, prefer overriding
* {@link InternalAggregationTestCase#registerPlugin()} instead because that route handles the automatic
* conversion of AggSpecs into namedWriteables.
*/
protected List<NamedWriteableRegistry.Entry> getNamedWriteables() {
SearchPlugin plugin = registerPlugin();
SearchModule searchModule = new SearchModule(Settings.EMPTY, plugin == null ? emptyList() : Collections.singletonList(plugin));
List<NamedWriteableRegistry.Entry> entries = new ArrayList<>(searchModule.getNamedWriteables());
// Modules/plugins may have extra namedwriteables that are not added by agg specs
if (plugin != null) {
entries.addAll(((Plugin) plugin).getNamedWriteables());
}
return entries;
}
use of org.opensearch.search.SearchModule in project OpenSearch by opensearch-project.
the class ShardValidateQueryRequestTests method setUp.
public void setUp() throws Exception {
super.setUp();
IndicesModule indicesModule = new IndicesModule(Collections.emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList());
List<NamedWriteableRegistry.Entry> entries = new ArrayList<>();
entries.addAll(indicesModule.getNamedWriteables());
entries.addAll(searchModule.getNamedWriteables());
namedWriteableRegistry = new NamedWriteableRegistry(entries);
}
use of org.opensearch.search.SearchModule in project anomaly-detection by opensearch-project.
the class TestHelpers method randomFeatureQuery.
public static SearchSourceBuilder randomFeatureQuery() throws IOException {
String query = "{\"query\":{\"match\":{\"user\":{\"query\":\"kimchy\",\"operator\":\"OR\",\"prefix_length\":0," + "\"max_expansions\":50,\"fuzzy_transpositions\":true,\"lenient\":false,\"zero_terms_query\":\"NONE\"," + "\"auto_generate_synonyms_phrase_query\":true,\"boost\":1}}}}";
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
SearchModule searchModule = new SearchModule(Settings.EMPTY, false, Collections.emptyList());
XContentParser parser = XContentType.JSON.xContent().createParser(new NamedXContentRegistry(searchModule.getNamedXContents()), LoggingDeprecationHandler.INSTANCE, query);
searchSourceBuilder.parseXContent(parser);
return searchSourceBuilder;
}
Aggregations