Initial questions about elasticsearch


(Antonios Chalkiopoulos) #1

ElasticSearch is an amazing product, that i'm trying to master, but have
some queries:

I just switched to version 1.0.0 - so the code below is run against that
version

1. I start with a fresh & clean installation and try to add a mapping:

PUT infopoint/DIVER/_mapping
{
"mapping" : {
"DIVER" : {
"properties" : {
"location" : {
"type" : "geo_point",
"lat_lon": true,
"geohash": true
},
"image" : {"index" : "no"}
}
}
}
}

I fail with a IndexMissingException[[infopoint] missing] message

You get the idea - i want to have the location geo-hashed and i want to
exclude the image from indexing

  • so that the image is returned on a query, but matching on the image text
    should not return the document

2. Ok, i decide to create a infopoint/DIVER with

PUT infopoint/DIVER/123

{
"name": "Chania Diving",
"nameLocal": "Kαταδυτικό Χανίων",
"image": "http://c.commonstorage.google.com/bla/blah/blah.jpg",
"location" : {
"lat" : 15.5,
"lon" : 15.1
},
"area1": "Crete",
"area1Local": "Κρήτη",
"countryCode": "GR"
}
After adding the first document, then i i can update the mapping.

What i would like to do it set the mapping on */infopoint/ *just once on a
fresh elastic-search and have this mapping across all new /infopoint/
documents

3. When i run a search looking for blah.jpg i get a response :frowning:

POST infopoint/_search
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "blah.jpg"
}
}
}
}
}

I though i excluded the "image" from the index :frowning:

*4. *I would like to associate some tags to my documents. So for example
for the DIVER i would like to add the
translations in Greek, Spanish etc languages... so that i can retrieve
document even if users use a different language than english

As those 'translations' are static, i would like to attach them into the
/infopoint/DIVER/ just once
instead of having to transmit them every single time i index a document

Thanks a lot
Any help or pointers to a book or tutorial will be appreciated

Antonios

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b9408a53-7fbf-45a2-950e-01d9b0edd679%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly) #2

1/2) There are several ways, but one way to create an index + mapping in
one shot is:

PUT http://localhost:9200/infopoint
{
"mappings" : {
"DIVER" : {
"properties" : {
"location" : {
"type" : "geo_point",
"lat_lon": true,
"geohash": true
},
"image" : {"index" : "no", "type": "string"}
}
}
}
}

  1. There is an _all field that is automatically introduced by ES. It
    contains a concatenation of all the field values in your JSON document.
    When you do this search:

{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "blah.jpg"
}
}
}
}
}

You don't specify a field, so by default it looks for "blah.jpg" in the
_all field, which contains the value from your image field (plus all other
fields) which is why it matches. If you do something like this:

{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "image:blah.jpg"
}
}
}
}
}

Then you won't get a match if the image field is not indexed.

  1. You can embed translations/tags in your document as additional fields
    but you will need to reindex the document every time you change it or any
    of its contents (such as translations/tags).

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8cd43f57-7c5f-4d27-a472-ecdf573fe891%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3