Some questions about schema/mapping/indexes/filters

I'm new to elastic search and i've read some of the docs and still have
some questions:

  1. I have a 'user' document. This user can belong to several 'groups'
    and have several settings for each group. How can i have a mapping so i can
    search on users that have a group_id and administrator in that group
    storing all data in the user document?
  2. Fields that aren't specified in the mapping are not indexed? Because
    i don't want to index/search on every field.
  3. Are documents/_source compressed together in blocks or separately?
  4. If i store the _source i don't need to store fields?
  5. If i update a document and change a non-indexed/non-mapped field will
    the document be reindexed?
  6. If i only want to text-search on 3 fields(title,arrays[],description)
    should i put only these in the _all field or something else?
  7. Can i search 'more_like_this' WHERE a=1 AND b=24 AND c=True ?
  8. Should i use ECC RAM ?

Thanks

--
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.

Hello,

I'll answer inline. Excuse my Gmail messing with your numbering :frowning:

On Mon, Sep 2, 2013 at 2:06 AM, ddorian43 dorian.hoxha@gmail.com wrote:

I'm new to Elasticsearch and i've read some of the docs and still have
some questions:

  1. I have a 'user' document. This user can belong to several 'groups'
    and have several settings for each group. How can i have a mapping so i can
    search on users that have a group_id and administrator in that group
    storing all data in the user document?

You can have a nested
typehttp://www.elasticsearch.org/guide/reference/mapping/nested-type/under
each user, to get something like:

{
"name": "test-user",
"groups": [
{
"group_id": 1,
"is_admin": true
},
{
"group_id": 2,
"is_admin": false
}
]
}

And then to search, you can wrap a bool
queryhttp://www.elasticsearch.org/guide/reference/query-dsl/bool-query.htmlin
a nested
query http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/and
specify the group_id and the is_admin value you need. And it will only
match users who have a group object with both properties.

  1. Fields that aren't specified in the mapping are not indexed?
    Because i don't want to index/search on every field.

If a field is not in the mapping, when you add a new document that has it,
ES will try and guess what that field is and append the mapping for you.
Unless you disable dynamic mappings, in which case indexing that document
will fail.

If you need to disable indexing a field, you can have "index": "no" for
that field. Its content will still be stored in the _source field.

  1. Are documents/_source compressed together in blocks or separately?

In 0.90 or later, they're compressed in blocks.

  1. If i store the _source i don't need to store fields?

No, the fields will be retrieved from source. You can still store
individual fields (or store fields and not _source), but the default is
recommended.

  1. If i update a document and change a non-indexed/non-mapped field
    will the document be reindexed?

When you update a document, it's reindexed. A field that's not mapped can't
be changed, because it means it's not there. If a field is stored, but not
indexed, it can be updated, but it will still not be indexed. I hope this
answers your question, because I'm not sure I'm getting it.

  1. If i only want to text-search on 3
    fields(title,arrays,description) should i put only these in the _all
    field or something else?

That's an option, yes. Or you can search in all three fields (for example,
by using a multi_match or a bool query).

  1. Can i search 'more_like_this' WHERE a=1 AND b=24 AND c=True ?

I don't think you can. For integers and booleans, you can simply query for
those values using something like a term query.

  1. Should i use ECC RAM ?

If it's something your motherboard supports, I guess some extra reliability
never hurts :slight_smile:

Best regards,
Radu

http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

--
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.

Thanks for the answers. So i need to map every field. What about:

  1. How to map a 'map' field where i don't know the keys and don't want
    to index it ? Or is there a index_field_default:False?
  2. Documents of different types inside 1 index with the same
    _routing.value will reside in the same shard?
  3. If i want autocomplete on arrays i would need n-grams. If i n-gram
    arrays does it go as whole words in the _all field (i want to)? Should i
    use multi_type?
  4. Is it better(performance) to use 1index with 7 types or 7 indexes
    with 1 type each (will never search all types at the same time)?

On Tue, Sep 3, 2013 at 1:05 PM, Radu Gheorghe radu.gheorghe@sematext.comwrote:

Hello,

I'll answer inline. Excuse my Gmail messing with your numbering :frowning:

On Mon, Sep 2, 2013 at 2:06 AM, ddorian43 dorian.hoxha@gmail.com wrote:

I'm new to Elasticsearch and i've read some of the docs and still have
some questions:

  1. I have a 'user' document. This user can belong to several 'groups'
    and have several settings for each group. How can i have a mapping so i can
    search on users that have a group_id and administrator in that group
    storing all data in the user document?

You can have a nested typehttp://www.elasticsearch.org/guide/reference/mapping/nested-type/under each user, to get something like:

{
"name": "test-user",
"groups": [
{
"group_id": 1,
"is_admin": true
},
{
"group_id": 2,
"is_admin": false
}
]
}

And then to search, you can wrap a bool queryhttp://www.elasticsearch.org/guide/reference/query-dsl/bool-query.htmlin a nested
queryhttp://www.elasticsearch.org/guide/reference/query-dsl/nested-query/and specify the group_id and the is_admin value you need. And it will only
match users who have a group object with both properties.

  1. Fields that aren't specified in the mapping are not indexed?
    Because i don't want to index/search on every field.

If a field is not in the mapping, when you add a new document that has it,
ES will try and guess what that field is and append the mapping for you.
Unless you disable dynamic mappings, in which case indexing that document
will fail.

If you need to disable indexing a field, you can have "index": "no" for
that field. Its content will still be stored in the _source field.

  1. Are documents/_source compressed together in blocks or separately?

In 0.90 or later, they're compressed in blocks.

  1. If i store the _source i don't need to store fields?

No, the fields will be retrieved from source. You can still store
individual fields (or store fields and not _source), but the default is
recommended.

  1. If i update a document and change a non-indexed/non-mapped field
    will the document be reindexed?

When you update a document, it's reindexed. A field that's not mapped
can't be changed, because it means it's not there. If a field is stored,
but not indexed, it can be updated, but it will still not be indexed. I
hope this answers your question, because I'm not sure I'm getting it.

  1. If i only want to text-search on 3
    fields(title,arrays,description) should i put only these in the _all
    field or something else?

That's an option, yes. Or you can search in all three fields (for example,
by using a multi_match or a bool query).

  1. Can i search 'more_like_this' WHERE a=1 AND b=24 AND c=True ?

I don't think you can. For integers and booleans, you can simply query for
those values using something like a term query.

  1. Should i use ECC RAM ?

If it's something your motherboard supports, I guess some extra
reliability never hurts :slight_smile:

Best regards,
Radu

http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/9o_RuNfSK4Q/unsubscribe.
To unsubscribe from this group and all its topics, 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.