opensearch-project / opensearch-project/opensearch-java
[BUG] match_only_text does not return analyzer and search_analyzer
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 165
- Forks
- 250
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 26
Description
What is the bug?
GetMappingRequest does not return analyzer and search_analyzer for type match_only_text
How can one reproduce the bug?
OpenSearchClient client = //TODO init
client.generic().execute(Requests.builder()
.endpoint("struthio-camelus")
.method("PUT")
.body(Body.from("""
{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
},
"mappings": {
"properties": {
"egg-color": {
"type": "text",
"analyzer": "standard",
"search_analyzer": "whitespace"
},
"feather-color": {
"type": "match_only_text",
"analyzer": "standard",
"search_analyzer": "whitespace"
}
}
}
}
""".getBytes(StandardCharsets.UTF_8), "application/json"))
.build());
GetMappingRequest request = GetMappingRequest.builder()
.index("struthio-camelus")
.build();
GetMappingResponse response = client.indices().getMapping(request);
System.out.println(response.toJsonString());
What is the expected behavior?
egg-color and feather-color should both return both analyzers, but only the egg-color returns both
match_only_text should have the parameters according to the documentation
An http call on the index also returns both analyzers on the match_only_text field
What is your host/environment?
Docker OS 3.7.0 , java client 3.9.0
Do you have any screenshots?
Output of System.out:
{
"struthio-camelus": {
"mappings": {
"properties": {
"egg-color": {
"type": "text",
"analyzer": "standard",
"search_analyzer": "whitespace"
},
"feather-color": {
"type": "match_only_text"
}
}
}
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the GetMappingRequest and GetMappingResponse entry points and reproduce the mapping shown in the issue against OpenSearch 3.7.0. Compare the Java client's response with the HTTP mapping response, then verify that match_only_text preserves analyzer and search_analyzer like text does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100