Elasticsearch اسئلة واجوبة المقابلات
سؤال 6. Explain the purpose of the 'Percolator' in Elasticsearch.
The 'Percolator' in Elasticsearch is used for reverse searching. Instead of searching for documents, it allows you to register queries and match them against incoming documents.
Example:
PUT /my_index/_doc/my_percolator_query
{
"query": {
"match": {
"field": "value"
}
}
}
سؤال 7. How can you limit the number of results in an Elasticsearch query?
You can use the 'size' parameter in your query to limit the number of results returned. For example, 'size': 10 will return only 10 documents.
Example:
GET /my_index/_search
{
"query": {
"match_all": {}
},
"size": 10
}
سؤال 8. What is the purpose of the 'Script' query in Elasticsearch?
The 'Script' query allows you to execute custom scripts during the search process. It is useful for complex calculations or custom scoring logic.
Example:
GET /my_index/_search
{
"query": {
"script": {
"script": {
"source": "doc['field'].value > 10"
}
}
}
}
سؤال 9. Explain the concept of 'Field Data' in Elasticsearch.
Field Data in Elasticsearch is used to cache field values in memory for better performance. It is essential for aggregations and sorting operations.
Example:
GET /my_index/_search
{
"aggs": {
"sum_prices": {
"sum": {
"field": "price",
"format": "doc_values"
}
}
}
}
سؤال 10. What is Elasticsearch?
Elasticsearch is a distributed search and analytics engine built on top of Apache Lucene.
الاكثر فائدة حسب تقييم المستخدمين: