Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.0] Add yaml test for random_score in function_score query (#124893) #125003

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
"Random":
- do:
indices.create:
index: test
body:
mappings:
properties:
text:
type: text

- do:
index:
index: test
id: "1"
body: { text: "foo bar", uuid: 1234}

- do:
index:
index: test
id: "2"
body: { text: "high bar", uuid: 5678 }

- do:
index:
index: test
id: "3"
body: { text: "raise bar", uuid: 9012 }

- do:
index:
index: test
id: "3"
body: { text: "raise hands", uuid: 3456 }

- do:
indices.refresh:
index: [ test ]

- do:
search:
index: test
body:
size: 10
query:
"function_score": {
"query": {
"match": {
"text": "bar"
}
},
"random_score": {
"seed": 10,
"field": "_seq_no"
}
}

- length: { hits.hits: 2 }
- match: { hits.total.value: 2 }

- do:
search:
index: test
body:
size: 10
query:
"function_score": {
"query": {
"match": {
"text": "bar"
}
},
"random_score": {
"seed": 10
}
}

- length: { hits.hits: 2 }
- match: { hits.total.value: 2 }

- do:
search:
index: test
body:
size: 10
query:
"function_score": {
"query": {
"match": {
"text": "bar"
}
},
"random_score": {
"seed": 10,
"field": "uuid"
}
}

- length: { hits.hits: 2 }
- match: { hits.total.value: 2 }