Elasticsearch DSL (Domain Specific Language)¶
Elasticsearch DSL is the Domain Specific Language used to query and interact with Elasticsearch.^[600-developer__Elasticsearch.md] It functions as the primary interface for executing searches, acting as the Elasticsearch equivalent of SQL in relational databases.^[600-developer__Elasticsearch.md]
Query Execution¶
Developers typically execute DSL queries using the Kibana Dev Tools.^[600-developer__Elasticsearch.md] In this environment, the query string is formatted and sent to the Elasticsearch cluster to retrieve results.
Core Query Types¶
The DSL provides specific methods for handling different data granularities, primarily distinguishing between treating input as a single token versus breaking it down for analysis.
term vs match¶
term: Used for exact matches where the input is treated as a single word or token.^[600-developer__Elasticsearch.md] For example, searching for"iphone 手機"using atermquery treats the entire string as one specific term, rather than separate keywords.match: Used for full-text search where the input is analyzed and broken into tokens (分詞).^[600-developer__Elasticsearch.md] This allows the search engine to find documents based on individual components of the input string.
Related Concepts¶
- Elasticsearch
- Inverted Index
- [[Mapping]]