Combining fields from various indexes

Hello.
Sorry for confused question.

I have index "User" with users profiles. Each profile have filed "city":
{"Name" : "Ivan", "City" : "Moscow"},
{"Name" : "Peter", "City" : "London"},
{"Name" : "Mikhail", "City" : "New-York"}

Also I have index "Geo" with cities coordinates:
{"City" : "Moscow", "lat" : "55.75", "lon" : "37.62"},
{"City" : "London", "lat" : "51.51", "lon" : " -0.13"},
{"City" : "New-York", "lat" : "40.73", "lon" : "-73.99"}

Is it possible, when I'm query User (get by Name or in search results),
aslo "automatically" query by City inside Geo index and get results like
coordinates was stored in User index?
Thus, result for "Ivan" will be {"Name" : "Ivan", "City" : "Moscow", "lat"
: "55.75", "lon" : "37.62"}, combined by field City from another (Geo)
index?

Or, I always need to query with filter?

Thank You!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Why not indexing City with coordinates in User type?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 6 mars 2013 à 10:22, Alexander Peregudov alexander.peregudov@gmail.com a écrit :

Hello.
Sorry for confused question.

I have index "User" with users profiles. Each profile have filed "city":
{"Name" : "Ivan", "City" : "Moscow"},
{"Name" : "Peter", "City" : "London"},
{"Name" : "Mikhail", "City" : "New-York"}

Also I have index "Geo" with cities coordinates:
{"City" : "Moscow", "lat" : "55.75", "lon" : "37.62"},
{"City" : "London", "lat" : "51.51", "lon" : " -0.13"},
{"City" : "New-York", "lat" : "40.73", "lon" : "-73.99"}

Is it possible, when I'm query User (get by Name or in search results), aslo "automatically" query by City inside Geo index and get results like coordinates was stored in User index?
Thus, result for "Ivan" will be {"Name" : "Ivan", "City" : "Moscow", "lat" : "55.75", "lon" : "37.62"}, combined by field City from another (Geo) index?

Or, I always need to query with filter?

Thank You!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

It's good and simple solution :slight_smile: But when I need to update City data
(correct coordinates or add new cities) I also need to reindex User.
If I have some Indexes (databases), each of them reffer to Geo Index
(databese)? I need to update each Index after make changes to Geo.
And, before bulk indexing Users JSON, I must merge User and Geo data by
script.

May be new feature of 0.90 can help me

On Wednesday, March 6, 2013 1:23:33 PM UTC+4, David Pilato wrote:

Why not indexing City with coordinates in User type?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 6 mars 2013 à 10:22, Alexander Peregudov <alexander...@gmail.com<javascript:>>
a écrit :

Hello.
Sorry for confused question.

I have index "User" with users profiles. Each profile have filed "city":
{"Name" : "Ivan", "City" : "Moscow"},
{"Name" : "Peter", "City" : "London"},
{"Name" : "Mikhail", "City" : "New-York"}

Also I have index "Geo" with cities coordinates:
{"City" : "Moscow", "lat" : "55.75", "lon" : "37.62"},
{"City" : "London", "lat" : "51.51", "lon" : " -0.13"},
{"City" : "New-York", "lat" : "40.73", "lon" : "-73.99"}

Is it possible, when I'm query User (get by Name or in search results),
aslo "automatically" query by City inside Geo index and get results like
coordinates was stored in User index?
Thus, result for "Ivan" will be {"Name" : "Ivan", "City" : "Moscow",
"lat" : "55.75", "lon" : "37.62"}, combined by field City from another
(Geo) index?

Or, I always need to query with filter?

Thank You!

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Probably. This new feature could help.

That said, the simplier, the better.

Cities are constant, even after an earthquake! :wink:
So I would not consider modifying city coordinates as a real user story.

So yes there is a price to pay when you want to correct city coordinates but is it a common and daily operation?
How many users do you have?
How many should be concerned when a city "moves"?

I don't say that you must do it as I suggest but you should just think about it.

My 2 cents.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 mars 2013 à 11:55, Alexander Peregudov alexander.peregudov@gmail.com a écrit :

It's good and simple solution :slight_smile: But when I need to update City data (correct coordinates or add new cities) I also need to reindex User.
If I have some Indexes (databases), each of them reffer to Geo Index (databese)? I need to update each Index after make changes to Geo.
And, before bulk indexing Users JSON, I must merge User and Geo data by script.

May be new feature of 0.90 can help me - Query DSL: Terms filter to allow for terms lookup from another document · Issue #2674 · elastic/elasticsearch · GitHub ?

On Wednesday, March 6, 2013 1:23:33 PM UTC+4, David Pilato wrote:

Why not indexing City with coordinates in User type?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 6 mars 2013 à 10:22, Alexander Peregudov alexander...@gmail.com a écrit :

Hello.
Sorry for confused question.

I have index "User" with users profiles. Each profile have filed "city":
{"Name" : "Ivan", "City" : "Moscow"},
{"Name" : "Peter", "City" : "London"},
{"Name" : "Mikhail", "City" : "New-York"}

Also I have index "Geo" with cities coordinates:
{"City" : "Moscow", "lat" : "55.75", "lon" : "37.62"},
{"City" : "London", "lat" : "51.51", "lon" : " -0.13"},
{"City" : "New-York", "lat" : "40.73", "lon" : "-73.99"}

Is it possible, when I'm query User (get by Name or in search results), aslo "automatically" query by City inside Geo index and get results like coordinates was stored in User index?
Thus, result for "Ivan" will be {"Name" : "Ivan", "City" : "Moscow", "lat" : "55.75", "lon" : "37.62"}, combined by field City from another (Geo) index?

Or, I always need to query with filter?

Thank You!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

:slight_smile:
But, I think it's will be better to have something, that can get data from
various indexes, combine them by known fields and do it in realtime.
Define mapping, where one field linked with field(s) from other indexes or
link field with the query. Yes, this looks like mostrous SQL queries :frowning:

Alexander

On Wednesday, March 6, 2013 3:22:53 PM UTC+4, David Pilato wrote:

Probably. This new feature could help.

That said, the simplier, the better.

Cities are constant, even after an earthquake! :wink:
So I would not consider modifying city coordinates as a real user story.

So yes there is a price to pay when you want to correct city coordinates
but is it a common and daily operation?
How many users do you have?
How many should be concerned when a city "moves"?

I don't say that you must do it as I suggest but you should just think
about it.

My 2 cents.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 mars 2013 à 11:55, Alexander Peregudov <alexander...@gmail.com<javascript:>>
a écrit :

It's good and simple solution :slight_smile: But when I need to update City data
(correct coordinates or add new cities) I also need to reindex User.
If I have some Indexes (databases), each of them reffer to Geo Index
(databese)? I need to update each Index after make changes to Geo.
And, before bulk indexing Users JSON, I must merge User and Geo data by
script.

May be new feature of 0.90 can help me -
Query DSL: Terms filter to allow for terms lookup from another document · Issue #2674 · elastic/elasticsearch · GitHub ?

On Wednesday, March 6, 2013 1:23:33 PM UTC+4, David Pilato wrote:

Why not indexing City with coordinates in User type?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 6 mars 2013 à 10:22, Alexander Peregudov alexander...@gmail.com a
écrit :

Hello.
Sorry for confused question.

I have index "User" with users profiles. Each profile have filed "city":
{"Name" : "Ivan", "City" : "Moscow"},
{"Name" : "Peter", "City" : "London"},
{"Name" : "Mikhail", "City" : "New-York"}

Also I have index "Geo" with cities coordinates:
{"City" : "Moscow", "lat" : "55.75", "lon" : "37.62"},
{"City" : "London", "lat" : "51.51", "lon" : " -0.13"},
{"City" : "New-York", "lat" : "40.73", "lon" : "-73.99"}

Is it possible, when I'm query User (get by Name or in search results),
aslo "automatically" query by City inside Geo index and get results like
coordinates was stored in User index?
Thus, result for "Ivan" will be {"Name" : "Ivan", "City" : "Moscow",
"lat" : "55.75", "lon" : "37.62"}, combined by field City from another
(Geo) index?

Or, I always need to query with filter?

Thank You!

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I am afraid we don't have joins yet :slight_smile: I am recommending you to either
duplicate data or do a second request.

simon

On Wednesday, March 6, 2013 1:12:33 PM UTC+1, Alexander Peregudov wrote:

:slight_smile:
But, I think it's will be better to have something, that can get data from
various indexes, combine them by known fields and do it in realtime.
Define mapping, where one field linked with field(s) from other indexes or
link field with the query. Yes, this looks like mostrous SQL queries :frowning:

Alexander

On Wednesday, March 6, 2013 3:22:53 PM UTC+4, David Pilato wrote:

Probably. This new feature could help.

That said, the simplier, the better.

Cities are constant, even after an earthquake! :wink:
So I would not consider modifying city coordinates as a real user story.

So yes there is a price to pay when you want to correct city coordinates
but is it a common and daily operation?
How many users do you have?
How many should be concerned when a city "moves"?

I don't say that you must do it as I suggest but you should just think
about it.

My 2 cents.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 mars 2013 à 11:55, Alexander Peregudov alexander...@gmail.com a
écrit :

It's good and simple solution :slight_smile: But when I need to update City data
(correct coordinates or add new cities) I also need to reindex User.
If I have some Indexes (databases), each of them reffer to Geo Index
(databese)? I need to update each Index after make changes to Geo.
And, before bulk indexing Users JSON, I must merge User and Geo data by
script.

May be new feature of 0.90 can help me -
Query DSL: Terms filter to allow for terms lookup from another document · Issue #2674 · elastic/elasticsearch · GitHub ?

On Wednesday, March 6, 2013 1:23:33 PM UTC+4, David Pilato wrote:

Why not indexing City with coordinates in User type?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 6 mars 2013 à 10:22, Alexander Peregudov alexander...@gmail.com a
écrit :

Hello.
Sorry for confused question.

I have index "User" with users profiles. Each profile have filed "city":
{"Name" : "Ivan", "City" : "Moscow"},
{"Name" : "Peter", "City" : "London"},
{"Name" : "Mikhail", "City" : "New-York"}

Also I have index "Geo" with cities coordinates:
{"City" : "Moscow", "lat" : "55.75", "lon" : "37.62"},
{"City" : "London", "lat" : "51.51", "lon" : " -0.13"},
{"City" : "New-York", "lat" : "40.73", "lon" : "-73.99"}

Is it possible, when I'm query User (get by Name or in search results),
aslo "automatically" query by City inside Geo index and get results like
coordinates was stored in User index?
Thus, result for "Ivan" will be {"Name" : "Ivan", "City" : "Moscow",
"lat" : "55.75", "lon" : "37.62"}, combined by field City from another
(Geo) index?

Or, I always need to query with filter?

Thank You!

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.