Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic Search and "sub queries"

Can you perform a subquery in Elastic Search?

I am finding a list of documents (usually about 5-20 documents). For each of the documents I'd like to perform a search to come up with some custom fields for them.

Each document is a property, and, I want to analyze surrounding properties for each property found in order to evaluate the average price of properties around it.

Thanks

like image 781
David Kullmann Avatar asked Jan 10 '12 18:01

David Kullmann


People also ask

What kind of queries does Elasticsearch support?

Elasticsearch provides a full Query DSL (Domain Specific Language) based on JSON to define queries. Think of the Query DSL as an AST (Abstract Syntax Tree) of queries, consisting of two types of clauses: Leaf query clauses.

What is the difference between query and filter in Elasticsearch?

Queries are slower it returns a calculated score of how well a document matches the query. Filters are faster because they check only if the document matched or not. Queries produce non-boolean values. Filters produce boolean values.

What is sub query give an example?

A subquery is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved. Subqueries can be used with the SELECT, INSERT, UPDATE, and DELETE statements along with the operators like =, <, >, >=, <=, IN, BETWEEN, etc.

Is Elasticsearch faster than MySQL?

Elasticsearch is also built on Apache Lucene, which is much faster and able to handle larger amounts of data than MySQL Document Store.


1 Answers

No, Elastic Search doesn't support subqueries.

You should be able to do this with an IDs query:
http://www.elasticsearch.org/guide/reference/query-dsl/ids-query.html

like image 54
gjb Avatar answered Sep 16 '22 11:09

gjb