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
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.
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.
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.
Elasticsearch is also built on Apache Lucene, which is much faster and able to handle larger amounts of data than MySQL Document Store.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With