Description
Describe the bug
I have a document with a field (array) that stores multiple objects with one text attribute. when I execute a match_phrase_prefix query on that text field I do not see any hits when there are multiple objects in the array. However, when the first inner object's text field is a match, I do see the document as a hit.
To Reproduce
Create a below sample mapping
{
"mappings": {
"properties": {
"platform_name": {
"type": "text",
"index_prefixes": { }
},
"applications": {
"properties": {
"name": { "type": "text", "index_prefixes": { } },
"app_version": { "type": "keyword" },
"publisher": { "type": "text" }
}
}
}
}
}
}
Sample document
{
"platform_name": "Red Hat",
"applications": [
{ "name": "red18", "version": "v2", "publisher": "red brown ltd"},
{ "name": "bind-libs", "version": "v1", "publisher": "red brown ltd"},
{ "name": "python-libs", "version": "v1", "publisher": "red brown ltd"},
{ "name": "python1-libs", "version": "v1", "publisher": "red brown ltd"},
{ "name": "python2-libs", "version": "v1", "publisher": "red brown ltd"},
{ "name": "python3-libs", "version": "v1", "publisher": "red brown ltd"},
{ "name": "python4-libs", "version": "v1", "publisher": "red brown ltd"},
{ "name": "python5-libs", "version": "v1", "publisher": "red brown ltd"},
{ "name": "python6-libs", "version": "v1", "publisher": "red brown ltd"},
{ "name": "python7-libs", "version": "v1", "publisher": "red brown ltd"}
],
}
Insert the above doc into an index.
Run below queries:
match_phrase query on applications.name field.
{
"query": {
"bool":{
"filter": [
{
"bool": {
"must": [
{
"match_phrase": {
"applications.name": "bind-libs"
}
}
]
}
}
]
}
}
}
match_phrase_prefix query on applications.name field.
{
"query": {
"bool":{
"filter": [
{
"bool": {
"must": [
{
"match_phrase_prefix": {
"applications.name": "bind-lib"
}
}
]
}
}
]
}
}
}
Expected behavior
Both match_phrase and match_phrase_prefix query should return the document as a hit. However, only match_phrase query returns a hit.
Plugins
None
Screenshots
None
Host/Environment (please complete the following information):
- OS: MacOs
- Version
- opensearch: latest (2.7)
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status