I have the following domain model:
[Office] -----* [Employee]
Employee has a reference to the corresponding Office object.
I want to index them independently and also want to be able to search
for employees by the office name, e.q. "_search?
q=employee.office.name:Head"
So I toss the following JSONs to ElasticSearch:
But when I change the office name I push the changed Office JSON to
the index and I need somehow to tell ElasticSearch to reindex all the
corresponding employee documents without having to do it explicitly.
So in my example I execute:
And I expect the following query to return Alex Wajda's Employee
object with the updated office properties:
curl -XPUT /myindex/employee/_search?
q=employee.office.name:Headquarter
No, there is no notion of relations in Elasticsearch.
You will have to programatically reindex the Employee document.
The best way to do this is to search for all employee documents with
the old office name, parse the _source field (that holds the original
JSON), make the appropriate changes in the JSON and reindex.
I have the following domain model:
[Office] -----* [Employee]
Employee has a reference to the corresponding Office object.
I want to index them independently and also want to be able to search
for employees by the office name, e.q. "_search?
q=employee.office.name:Head"
So I toss the following JSONs to Elasticsearch:
But when I change the office name I push the changed Office JSON to
the index and I need somehow to tell Elasticsearch to reindex all the
corresponding employee documents without having to do it explicitly.
So in my example I execute:
And I expect the following query to return Alex Wajda's Employee
object with the updated office properties:
curl -XPUT /myindex/employee/_search?
q=employee.office.name:Headquarter
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.