Skip to content

Fix: allow search id or _id - #14356

Merged
yingfeng merged 4 commits into
infiniflow:mainfrom
Lynn-Inf:fix/display-metadata
Apr 24, 2026
Merged

yingfeng merged 4 commits into
infiniflow:mainfrom
Lynn-Inf:fix/display-metadata

Conversation

@Lynn-Inf

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Allow search id or _id when using es as doc_engine.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 24, 2026
@dosubot dosubot Bot added the 🐞 bug Something isn't working, pull request that fix bug. label Apr 24, 2026
@Lynn-Inf Lynn-Inf added the ci Continue Integration label Apr 24, 2026
@Lynn-Inf
Lynn-Inf marked this pull request as draft April 24, 2026 09:15
@Lynn-Inf
Lynn-Inf marked this pull request as ready for review April 24, 2026 09:15
@coderabbitai

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The search query builder in Elasticsearch utilities now treats the id condition key as an alias matching both id and _id fields. It constructs bool filters with terms or term queries depending on input type, using should logic with minimum match requirement of 1.

Changes

Cohort / File(s) Summary
Elasticsearch Query Builder Enhancement
rag/utils/es_conn.py
Added logic to handle id as an alias for matching both id and _id fields with conditional query construction for list vs. scalar values using bool filters and should/minimum_should_match clauses.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hoppy hops through fields of search,
Where id and _id now perch,
On branches of the Elasticsearch tree,
Aliases dancing wild and free! 🌳✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enabling search by either 'id' or '_id' fields in Elasticsearch queries.
Description check ✅ Passed The description includes both required sections from the template: 'What problem does this PR solve?' and 'Type of change' with Bug Fix selected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Lynn-Inf Lynn-Inf mentioned this pull request Apr 24, 2026
4 tasks done

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
rag/utils/es_conn.py (1)

173-182: Consider using Q("ids", values=...) for the _id side for consistency with delete() and idiomatic ES.

Two observations on the new id branch:

  1. Consistency with delete(): The delete() method in this same file (lines 530–536) uses Q("ids", values=chunk_ids) to match the _id metadata field. The new search branch uses term/terms directly on _id instead. While term/terms queries on _id are fully supported across all Elasticsearch versions, aligning both code paths to use ids is more idiomatic and reduces the chance of subtle divergence if either method is later modified.

  2. Error handling consistency: Unlike the generic branch below (lines 189–191), this new branch silently continues for any v that is not list/str/int (e.g., dict). Consider falling through to the shared type check or explicitly raising the same exception so callers get consistent error feedback for malformed conditions.

♻️ Suggested refactor
             if k == "id":
                 if not v:
                     continue
                 if isinstance(v, list):
                     bool_query.filter.append(
-                        Q("bool", should=[Q("terms", id=v), Q("terms", _id=v)], minimum_should_match=1))
+                        Q("bool",
+                          should=[Q("terms", id=v), Q("ids", values=v)],
+                          minimum_should_match=1))
                 elif isinstance(v, str) or isinstance(v, int):
                     bool_query.filter.append(
-                        Q("bool", should=[Q("term", id=v), Q("term", _id=v)], minimum_should_match=1))
+                        Q("bool",
+                          should=[Q("term", id=v), Q("ids", values=[v])],
+                          minimum_should_match=1))
+                else:
+                    raise Exception(
+                        f"Condition `id={v!s}` value type is {type(v)!s}, expected to be int, str or list.")
                 continue
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rag/utils/es_conn.py` around lines 173 - 182, The id-handling branch in the
search builder should use the Elasticsearch ids query for the document id side
and add consistent type/error handling: replace the Q("term"/"terms", _id=...)
uses with Q("ids", values=...) when v is a single id or list (matching how
delete() uses Q("ids", values=chunk_ids")), and for unsupported types (e.g.,
dict) do not silently continue — either fall through to the shared type-check
logic or raise the same TypeError used by the generic branch so callers receive
consistent feedback; update the bool_query.filter append sites where Q(...) is
constructed and keep the existing handling for the non-_id field (id vs _id)
intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@rag/utils/es_conn.py`:
- Around line 173-182: The id-handling branch in the search builder should use
the Elasticsearch ids query for the document id side and add consistent
type/error handling: replace the Q("term"/"terms", _id=...) uses with Q("ids",
values=...) when v is a single id or list (matching how delete() uses Q("ids",
values=chunk_ids")), and for unsupported types (e.g., dict) do not silently
continue — either fall through to the shared type-check logic or raise the same
TypeError used by the generic branch so callers receive consistent feedback;
update the bool_query.filter append sites where Q(...) is constructed and keep
the existing handling for the non-_id field (id vs _id) intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9b9087d0-deb6-4111-b082-b391a055eda4

📥 Commits

Reviewing files that changed from the base of the PR and between 8a2f63e and c5fd0f1.

📒 Files selected for processing (1)
  • rag/utils/es_conn.py

@wangq8
wangq8 self-requested a review April 24, 2026 09:37
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 24, 2026
@codecov

codecov Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.30%. Comparing base (beb2406) to head (8fff646).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14356   +/-   ##
=======================================
  Coverage   95.30%   95.30%           
=======================================
  Files          10       10           
  Lines         703      703           
  Branches      112      112           
=======================================
  Hits          670      670           
  Misses         16       16           
  Partials       17       17           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yingfeng
yingfeng merged commit e22cf33 into infiniflow:main Apr 24, 2026
1 check passed
xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Apr 24, 2026
### What problem does this PR solve?

Allow search id or _id when using es as doc_engine.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
@coderabbitai coderabbitai Bot mentioned this pull request Apr 24, 2026
1 task done
@mustangxu

Copy link
Copy Markdown
Contributor

I got the following exception in the just-released 0.25.1:

2026-04-30 12:15:38,580 ERROR 151 ESConnection.search ['ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376'] query: {'query': {'bool': {'filter': [{'terms': {'kb_id': ['7c4e59126db011f094fda21b51604f78']}}, {'bool': {'should': [{'terms': {'id': ['31e68116444111f19d4209d3873a06f9', '31d25cae444111f18aefcb61807cc381', '31d19562444111f181cf0189cc547c95', '31ca0d56444111f189d3799441ff5d1c', '31c9d3ea444111f19d4209d3873a06f9', '3199272c444111f18aefcb61807cc381', '31994a04444111f1aee10d3e62db5fc3', '31969f70444111f181cf0189cc547c95', '3194b82c444111f19d4209d3873a06f9', 'd9cdfc0234cd11f1b3d6e389cf691741', 'd9b6167834cd11f1b3d6e389cf691741', 'd99d0e8a34cd11f1b3d6e389cf691741', 'd98a736a34cd11f1b3d6e389cf691741', 'd97132e234cd11f1b3d6e389cf691741', 'ecc8b9da33f311f1b3d6e389cf691741', 'ebb653b833f311f1b3d6e389cf691741', 'eb99b4c433f311f1b3d6e389cf691741', 'a094d8462f1111f1abd51d6253774230', 'fb0b96da2dcb11f1abd51d6253774230', '781433da2b7911f1b5376f1481228048', '77f8cc442b7911f1b5376f1481228048', '77d498d82b7911f1b5376f1481228048', '76228736281b11f1b5376f1481228048', '75f4eab0281b11f1b5376f1481228048', '05683244276111f1a907d732cf3eb6fe', '9f20ead024f911f1afc8e97c1fc0e80b', '9ec5ecde24f911f1afc8e97c1fc0e80b', '9e4e782024f911f1afc8e97c1fc0e80b', '9e30370224f911f1afc8e97c1fc0e80b', '9e12bdbc24f911f1afc8e97c1fc0e80b']}}, {'terms': {'_id': ['31e68116444111f19d4209d3873a06f9', '31d25cae444111f18aefcb61807cc381', '31d19562444111f181cf0189cc547c95', '31ca0d56444111f189d3799441ff5d1c', '31c9d3ea444111f19d4209d3873a06f9', '3199272c444111f18aefcb61807cc381', '31994a04444111f1aee10d3e62db5fc3', '31969f70444111f181cf0189cc547c95', '3194b82c444111f19d4209d3873a06f9', 'd9cdfc0234cd11f1b3d6e389cf691741', 'd9b6167834cd11f1b3d6e389cf691741', 'd99d0e8a34cd11f1b3d6e389cf691741', 'd98a736a34cd11f1b3d6e389cf691741', 'd97132e234cd11f1b3d6e389cf691741', 'ecc8b9da33f311f1b3d6e389cf691741', 'ebb653b833f311f1b3d6e389cf691741', 'eb99b4c433f311f1b3d6e389cf691741', 'a094d8462f1111f1abd51d6253774230', 'fb0b96da2dcb11f1abd51d6253774230', '781433da2b7911f1b5376f1481228048', '77f8cc442b7911f1b5376f1481228048', '77d498d82b7911f1b5376f1481228048', '76228736281b11f1b5376f1481228048', '75f4eab0281b11f1b5376f1481228048', '05683244276111f1a907d732cf3eb6fe', '9f20ead024f911f1afc8e97c1fc0e80b', '9ec5ecde24f911f1afc8e97c1fc0e80b', '9e4e782024f911f1afc8e97c1fc0e80b', '9e30370224f911f1afc8e97c1fc0e80b', '9e12bdbc24f911f1afc8e97c1fc0e80b']}}], 'minimum_should_match': 1}}]}}, 'sort': [{'id': {'order': 'asc', 'unmapped_type': 'text'}}], 'from': 0, 'size': 1000, '_source': ['*'], 'timeout': '600s', 'track_total_hits': True}BadRequestError(400, 'search_phase_execution_exception', 'Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.', Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.)
Traceback (most recent call last):
File "/ragflow/rag/utils/es_conn.py", line 286, in search
res = self._es_search_once(index_names, q, track_total_hits=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ragflow/rag/utils/es_conn.py", line 68, in _es_search_once
return self.es.search(
^^^^^^^^^^^^^^^
File "/ragflow/.venv/lib/python3.12/site-packages/elasticsearch/_sync/client/utils.py", line 458, in wrapped
return api(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/ragflow/.venv/lib/python3.12/site-packages/elasticsearch/_sync/client/init.py", line 5114, in search
return self.perform_request( # type: ignore[return-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ragflow/.venv/lib/python3.12/site-packages/elasticsearch/_sync/client/_base.py", line 271, in perform_request
response = self._perform_request(
^^^^^^^^^^^^^^^^^^^^^^
File "/ragflow/.venv/lib/python3.12/site-packages/elasticsearch/_sync/client/_base.py", line 351, in _perform_request
raise HTTP_EXCEPTIONS.get(meta.status, ApiError)(
elasticsearch.BadRequestError: BadRequestError(400, 'search_phase_execution_exception', 'Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.', Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.)
2026-04-30 12:15:38,582 ERROR 151 Error getting metadata for documents: BadRequestError(400, 'search_phase_execution_exception', 'Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.', Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.)

I made a walk-around by skip id from sort list:

if order_by:
    orders = list()
    for field, order in order_by.fields:
        order = "asc" if order == 0 else "desc"
        if field in ["page_num_int", "top_int"]:
            order_info = {"order": order, "unmapped_type": "float",
                          "mode": "avg", "numeric_type": "double"}
        elif field.endswith("_int") or field.endswith("_flt"):
            order_info = {"order": order, "unmapped_type": "float"}
        # walk-around: skip `id` in sort list due to #14307
        elif field == "id":
            continue
        else:
            order_info = {"order": order, "unmapped_type": "text"}
        orders.append({field: order_info})
    s = s.sort(*orders)

@wangq8

wangq8 commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

I got the following exception in the just-released 0.25.1:

2026-04-30 12:15:38,580 ERROR 151 ESConnection.search ['ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376'] query: {'query': {'bool': {'filter': [{'terms': {'kb_id': ['7c4e59126db011f094fda21b51604f78']}}, {'bool': {'should': [{'terms': {'id': ['31e68116444111f19d4209d3873a06f9', '31d25cae444111f18aefcb61807cc381', '31d19562444111f181cf0189cc547c95', '31ca0d56444111f189d3799441ff5d1c', '31c9d3ea444111f19d4209d3873a06f9', '3199272c444111f18aefcb61807cc381', '31994a04444111f1aee10d3e62db5fc3', '31969f70444111f181cf0189cc547c95', '3194b82c444111f19d4209d3873a06f9', 'd9cdfc0234cd11f1b3d6e389cf691741', 'd9b6167834cd11f1b3d6e389cf691741', 'd99d0e8a34cd11f1b3d6e389cf691741', 'd98a736a34cd11f1b3d6e389cf691741', 'd97132e234cd11f1b3d6e389cf691741', 'ecc8b9da33f311f1b3d6e389cf691741', 'ebb653b833f311f1b3d6e389cf691741', 'eb99b4c433f311f1b3d6e389cf691741', 'a094d8462f1111f1abd51d6253774230', 'fb0b96da2dcb11f1abd51d6253774230', '781433da2b7911f1b5376f1481228048', '77f8cc442b7911f1b5376f1481228048', '77d498d82b7911f1b5376f1481228048', '76228736281b11f1b5376f1481228048', '75f4eab0281b11f1b5376f1481228048', '05683244276111f1a907d732cf3eb6fe', '9f20ead024f911f1afc8e97c1fc0e80b', '9ec5ecde24f911f1afc8e97c1fc0e80b', '9e4e782024f911f1afc8e97c1fc0e80b', '9e30370224f911f1afc8e97c1fc0e80b', '9e12bdbc24f911f1afc8e97c1fc0e80b']}}, {'terms': {'_id': ['31e68116444111f19d4209d3873a06f9', '31d25cae444111f18aefcb61807cc381', '31d19562444111f181cf0189cc547c95', '31ca0d56444111f189d3799441ff5d1c', '31c9d3ea444111f19d4209d3873a06f9', '3199272c444111f18aefcb61807cc381', '31994a04444111f1aee10d3e62db5fc3', '31969f70444111f181cf0189cc547c95', '3194b82c444111f19d4209d3873a06f9', 'd9cdfc0234cd11f1b3d6e389cf691741', 'd9b6167834cd11f1b3d6e389cf691741', 'd99d0e8a34cd11f1b3d6e389cf691741', 'd98a736a34cd11f1b3d6e389cf691741', 'd97132e234cd11f1b3d6e389cf691741', 'ecc8b9da33f311f1b3d6e389cf691741', 'ebb653b833f311f1b3d6e389cf691741', 'eb99b4c433f311f1b3d6e389cf691741', 'a094d8462f1111f1abd51d6253774230', 'fb0b96da2dcb11f1abd51d6253774230', '781433da2b7911f1b5376f1481228048', '77f8cc442b7911f1b5376f1481228048', '77d498d82b7911f1b5376f1481228048', '76228736281b11f1b5376f1481228048', '75f4eab0281b11f1b5376f1481228048', '05683244276111f1a907d732cf3eb6fe', '9f20ead024f911f1afc8e97c1fc0e80b', '9ec5ecde24f911f1afc8e97c1fc0e80b', '9e4e782024f911f1afc8e97c1fc0e80b', '9e30370224f911f1afc8e97c1fc0e80b', '9e12bdbc24f911f1afc8e97c1fc0e80b']}}], 'minimum_should_match': 1}}]}}, 'sort': [{'id': {'order': 'asc', 'unmapped_type': 'text'}}], 'from': 0, 'size': 1000, '_source': ['*'], 'timeout': '600s', 'track_total_hits': True}BadRequestError(400, 'search_phase_execution_exception', 'Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.', Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.)
Traceback (most recent call last):
File "/ragflow/rag/utils/es_conn.py", line 286, in search
res = self._es_search_once(index_names, q, track_total_hits=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ragflow/rag/utils/es_conn.py", line 68, in _es_search_once
return self.es.search(
^^^^^^^^^^^^^^^
File "/ragflow/.venv/lib/python3.12/site-packages/elasticsearch/_sync/client/utils.py", line 458, in wrapped
return api(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/ragflow/.venv/lib/python3.12/site-packages/elasticsearch/_sync/client/init.py", line 5114, in search
return self.perform_request( # type: ignore[return-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ragflow/.venv/lib/python3.12/site-packages/elasticsearch/_sync/client/_base.py", line 271, in perform_request
response = self._perform_request(
^^^^^^^^^^^^^^^^^^^^^^
File "/ragflow/.venv/lib/python3.12/site-packages/elasticsearch/_sync/client/_base.py", line 351, in _perform_request
raise HTTP_EXCEPTIONS.get(meta.status, ApiError)(
elasticsearch.BadRequestError: BadRequestError(400, 'search_phase_execution_exception', 'Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.', Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.)
2026-04-30 12:15:38,582 ERROR 151 Error getting metadata for documents: BadRequestError(400, 'search_phase_execution_exception', 'Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.', Fielddata is disabled on [_anonymous] in [ragflow_doc_meta_ba5e26dc243c11f0b981abef665f6376_new]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [_anonymous] in order to load field data by uninverting the inverted index. Note that this can use significant memory.)

I made a walk-around by skip id from sort list:

if order_by:
    orders = list()
    for field, order in order_by.fields:
        order = "asc" if order == 0 else "desc"
        if field in ["page_num_int", "top_int"]:
            order_info = {"order": order, "unmapped_type": "float",
                          "mode": "avg", "numeric_type": "double"}
        elif field.endswith("_int") or field.endswith("_flt"):
            order_info = {"order": order, "unmapped_type": "float"}
        # walk-around: skip `id` in sort list due to #14307
        elif field == "id":
            continue
        else:
            order_info = {"order": order, "unmapped_type": "text"}
        orders.append({field: order_info})
    s = s.sort(*orders)

@mustangxu let me check

@wangq8

wangq8 commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

sort by id does not make any sense because id is mapped as a text field, which is not for sorting, sort requires a keyword field, we should not sort by id. it is not an issue of this PR, but to limit the sort by to not support id.

@wangq8

wangq8 commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

@mustangxu raised a PR to not allow sort by it - #14526

@mustangxu mustangxu mentioned this pull request May 7, 2026
4 tasks done
@coderabbitai coderabbitai Bot mentioned this pull request May 9, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants