jgrgt
September 25, 2024, 12:46pm
1
Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): 2.17.0
Describe the issue :
I’ve just tried the example code at Terms - OpenSearch Documentation on a local, docker-compose cluster. But for the final query (direct query with bitmap encoded to base64) I get:
{
"type": "parsing_exception",
"reason": "[terms] query does not support [product_id]",
"line": 4,
"col": 21
}
When I try the query with a reference to customers (as documented on the page linked above), I get 0 results.
Do I need to enable something to get the bitmap functionality?
Configuration :
Defaults for docker-compose.
Relevant Logs or Screenshots :
I’ve confirmed this instruction has two points to be fixed.
product_id field should be integer
terms requires array value against specified key
Here is fixed instruction. Please check results on your side.
PUT /products
{
"mappings": {
"properties": {
"product_id": { "type": "integer" }
}
}
}
PUT products/_doc/1
{
"name": "Product 1",
"product_id" : 111
}
PUT products/_doc/2
{
"name": "Product 2",
"product_id" : 222
}
PUT products/_doc/3
{
"name": "Product 3",
"product_id" : 333
}
POST /products/_search
{
"query": {
"terms": {
"product_id": [
"111",
"222",
"333"
]
}
},
"profile": "true"
}
PUT /customers
{
"mappings": {
"properties": {
"customer_filter": {
"type": "binary",
"store": true
}
}
}
}
PUT customers/_doc/customer123
{
"customer_filter": "OjAAAAEAAAAAAAIAEAAAAG8A3gBNAQ=="
}
POST /products/_search
{
"query": {
"terms": {
"product_id": {
"index": "customers",
"id": "customer123",
"path": "customer_filter",
"store": true
},
"value_type": "bitmap"
}
},
"profile": "true"
}
POST /products/_search
{
"query": {
"terms": {
"product_id": [
"OjAAAAEAAAAAAAIAEAAAAG8A3gBNAQ=="
],
"value_type": "bitmap"
}
},
"profile": "true"
}
I’ve submit new issue for further investigation or document fix.
opened 01:09AM - 26 Sep 24 UTC
untriaged
**What do you want to do?**
- [*] Request a change to existing documentation…
- [ ] Add new documentation
- [*] Report a technical problem with the documentation
- [ ] Other
**Tell us about your request.** Provide a summary of the request.
Instruction for terms query with roaring bitmap introduced since 2.17 does not work appropriately. For more details of issue, please refer from https://forum.opensearch.org/t/bitmap-search-not-working/21631
I've confirmed roaring bitmap works well with fixed instruction. So I'd like submit fixed version to the repoisitory.
***Version:** List the OpenSearch version to which this issue applies, e.g. 2.14, 2.12--2.14, or all.
2.17+
**What other resources are available?** Provide links to related issues, POCs, steps for testing, etc.
- https://github.com/opensearch-project/documentation-website/pull/8133
- https://forum.opensearch.org/t/bitmap-search-not-working/21631
jgrgt
September 26, 2024, 7:55am
4
Thx a lot @tkykenmto ! Your example works indeed. And I’ve confirmed it on my own test data too. Both changes are required: the field needs to be mapped as an integer and the terms query needs to get an array value.