mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-22 23:23:56 -06:00
MongoDB: Upgrade driver version and adapt to server 8.0.x
This commit is contained in:
parent
930daed65f
commit
ceefc44cfe
@ -42,7 +42,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mongodb</groupId>
|
<groupId>org.mongodb</groupId>
|
||||||
<artifactId>mongodb-driver-sync</artifactId>
|
<artifactId>mongodb-driver-sync</artifactId>
|
||||||
<version>4.11.1</version>
|
<version>5.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022-2023 nosqlbench
|
* Copyright (c) 2022-2024 nosqlbench
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -22,8 +22,8 @@ import com.mongodb.ServerApi;
|
|||||||
import com.mongodb.ServerApiVersion;
|
import com.mongodb.ServerApiVersion;
|
||||||
import com.mongodb.client.MongoClient;
|
import com.mongodb.client.MongoClient;
|
||||||
import com.mongodb.client.MongoClients;
|
import com.mongodb.client.MongoClients;
|
||||||
import io.nosqlbench.nb.api.components.core.NBNamedElement;
|
|
||||||
import com.mongodb.client.MongoDatabase;
|
import com.mongodb.client.MongoDatabase;
|
||||||
|
import io.nosqlbench.nb.api.components.core.NBNamedElement;
|
||||||
import io.nosqlbench.nb.api.config.standard.ConfigModel;
|
import io.nosqlbench.nb.api.config.standard.ConfigModel;
|
||||||
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
|
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
|
||||||
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
|
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
|
||||||
@ -84,11 +84,11 @@ public class MongoSpace implements NBNamedElement, AutoCloseable {
|
|||||||
MongoClientSettings.getDefaultCodecRegistry()
|
MongoClientSettings.getDefaultCodecRegistry()
|
||||||
);
|
);
|
||||||
|
|
||||||
// https://www.mongodb.com/docs/v7.0/reference/stable-api
|
// https://www.mongodb.com/docs/manual/reference/stable-api
|
||||||
ServerApi serverApi = ServerApi.builder()
|
ServerApi serverApi = ServerApi.builder()
|
||||||
.version(ServerApiVersion.V1)
|
.version(ServerApiVersion.V1)
|
||||||
.deprecationErrors(false)
|
.deprecationErrors(false)
|
||||||
.strict(false)//Needed because createSearchIndexes is not in stable API
|
.strict(false) // Needed because createSearchIndexes is not in stable API (yet)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MongoClientSettings settings = MongoClientSettings.builder()
|
MongoClientSettings settings = MongoClientSettings.builder()
|
||||||
|
@ -92,17 +92,16 @@ blocks:
|
|||||||
indexes: [
|
indexes: [
|
||||||
{
|
{
|
||||||
name: "kv_value_vector_search_idx",
|
name: "kv_value_vector_search_idx",
|
||||||
|
type: "vectorSearch",
|
||||||
definition: {
|
definition: {
|
||||||
mappings: {
|
fields: [
|
||||||
dynamic: true,
|
{
|
||||||
fields: {
|
type: "vector",
|
||||||
value: {
|
path: "value",
|
||||||
type: "knnVector",
|
numDimensions: TEMPLATE(dimensions,1536),
|
||||||
dimensions: TEMPLATE(dimensions,1536),
|
|
||||||
similarity: "TEMPLATE(similarity_function,cosine)"
|
similarity: "TEMPLATE(similarity_function,cosine)"
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -134,6 +133,7 @@ blocks:
|
|||||||
"pipeline": [
|
"pipeline": [
|
||||||
{
|
{
|
||||||
"$vectorSearch": {
|
"$vectorSearch": {
|
||||||
|
"exact": false,
|
||||||
"index": "kv_value_vector_search_idx",
|
"index": "kv_value_vector_search_idx",
|
||||||
"path": "value",
|
"path": "value",
|
||||||
"queryVector": {test_floatlist},
|
"queryVector": {test_floatlist},
|
||||||
@ -157,15 +157,18 @@ blocks:
|
|||||||
- io.nosqlbench.adapter.mongodb.MongoDbUtils
|
- io.nosqlbench.adapter.mongodb.MongoDbUtils
|
||||||
verifier-init: |
|
verifier-init: |
|
||||||
k=TEMPLATE(top_k,100)
|
k=TEMPLATE(top_k,100)
|
||||||
relevancy=scriptingmetrics.newRelevancyMeasures(_parsed_op);
|
relevancy=new io.nosqlbench.nb.api.engine.metrics.wrappers.RelevancyMeasures(_parsed_op)
|
||||||
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.recall("recall",k));
|
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.recall("recall",k));
|
||||||
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.precision("precision",k));
|
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.precision("precision",k));
|
||||||
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.F1("F1",k));
|
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.F1("F1",k));
|
||||||
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.reciprocal_rank("RR",k));
|
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.reciprocal_rank("RR",k));
|
||||||
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.average_precision("AP",k));
|
relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.average_precision("AP",k));
|
||||||
|
windowed_relevancy = new io.nosqlbench.nb.api.engine.metrics.wrappers.WindowedRelevancyMeasures(_parsed_op,10);
|
||||||
|
windowed_relevancy.addFunction(io.nosqlbench.engine.extensions.computefunctions.RelevancyFunctions.recall("recall",k));
|
||||||
verifier: |
|
verifier: |
|
||||||
actual_indices=MongoDbUtils.getFieldFromResults("key",result);
|
actual_indices=MongoDbUtils.getFieldFromResults("key",result);
|
||||||
relevancy.accept({relevant_indices},actual_indices);
|
relevancy.accept({relevant_indices},actual_indices);
|
||||||
|
windowed_relevancy.accept({relevant_indices}, actual_indices);
|
||||||
return true;
|
return true;
|
||||||
main_write:
|
main_write:
|
||||||
params:
|
params:
|
||||||
|
Loading…
Reference in New Issue
Block a user