0

I'm using elasticsearch 0.90.2 and elasticsearch-river-mongodb 1.7.0 to retrieve data from mongodb's oplog. In the collection I'm trying to index I have thousands of structured records, let's just named them 'field1', 'field2', 'field3'...'field10'

Is there a way to index only 'field1' and 'field2' ? Does it matter if these as strings or date objects ?

Thanks

1 Answer 1

1

I never used river plugins, but one thing that I know is you can control index upon fields through mapping or template. For each field, you can specify the property "index", in mapping or template, to three different options: analyzed, not_analyzed, no. This is the official documentation.

Set to analyzed for the field to be indexed and searchable after being broken down into token using an analyzer. not_analyzed means that its still searchable, but does not go through any analysis process or broken down into tokens. no means that it won’t be searchable at all (as an individual field; it may still be included in _all). Setting to no disables include_in_all. Defaults to analyzed.

If you want your field still be searchable, go with "not_analyzed", otherwise "no". The type of fields should not matter.

Here is a mapping example from official website

{
    "tweet" : {
        "properties" : {
            "user" : {"type" : "string", "index" : "not_analyzed"},
            "message" : {"type" : "string", "null_value" : "na"},
            "postDate" : {"type" : "date"},
            "priority" : {"type" : "integer"},
            "rank" : {"type" : "float"}
        }
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Zhoutuo! Your answer helped. I created the index, then I created the mapping and then I attached the mongodb river on that index.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.