The implementation of json inverted index #41624
-
I see two json inverted index implementations, JsonInvertedIndex and JsonKeyStatsInvertedIndex. What are the differences between these two indexes? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
JsonInvertedIndex is for this feature: JsonKeyStatsInvertedIndex is for this enhancement: For JSON field, only one index type is supported: INVERTED. JsonInvertedIndex is for this index, it is a new index type that users can choose. |
Beta Was this translation helpful? Give feedback.
-
JsonInvertedIndex is designed to build an index on a specific JSON path, such as json["a"]. It is effective for accelerating queries like json["a"] == 1 where the path is explicitly known. On the other hand, JsonKeyStatsInvertedIndex (not yet officially released) automatically creates inverted indexes for all keys found in the JSON field. This makes it highly flexible and especially useful when each row contains different key names. For example: { "error_code": "404", "timestamp": "2025-04-30T12:00:00Z" } However, if your JSON field is more like a dense column — where every row contains the same key (e.g., all rows have "a" column), then the performance benefit from JsonKeyStatsIndex is limited. In those cases, it's better to use JsonInvertedIndex and explicitly define the path. |
Beta Was this translation helpful? Give feedback.
@YolandaLyj A comprehensive design document will subsequently be placed in the doc directory of the Milvus repository. Below is a summary explanation of the differences between the two.
Two-Level JSON Indexing Strategy for Query Optimization
Structure: Maintains inverted lists tracking:
Optimization Benefits: