I am having trouble doing hybrid search. to give you guys bit of background I am using semantic search created inference with openai embeddings.
const addIndex = async () => {
// try {
// await client.indices.delete({ index });
// } catch (err) {
// //
// }
await client.indices.create({
index,
mappings: {
properties: {
phrase: {
type: "semantic_text",
inference_id: "openai_embeddings",
},
copilot: {
type: "keyword",
},
org: {
type: "keyword",
},
topic: {
type: "keyword",
},
mode: {
type: "keyword",
},
},
},
});
console.log("created successfully");
};
const response = await client.transport.request({
method: "PUT",
path: "/_inference/text_embedding/openai_embeddings",
body: {
service: "openai",
service_settings: {
api_key: "xxxxxxxx-xxxxxxxx",
model_id: "text-embedding-3-small",
},
},
});
this is my search query
const response = await client.search({
index,
min_score: 0.8,
query: {
bool: {
must: {
semantic: {
field: "phrase",
query: "can i talk to a real person",
},
},
filter: [
{ term: { copilot: "67108e2e8c0611df3ad71109" } }, // Filter by copilotId
{ term: { mode: "DRAFT" } }, // Filter by mode
],
},
},
});
above query randomly works sometimes and doesnt work other times.
i make page to 1000 then it started giving results. why is pagesize altering the behaviour? Is it performing post filter? so that means it doesnt work if i have 2000 phrases? Please help me here.