Some quesstion about elasticsearch index optimization

Hi all
I Just beginning to learn elasticsearch,have some quesstion as

  1. how can i set index optimize threshold in configuration files ?
  2. i send an order as
    curl -XPOST 'http://localhost:9200/gindex/_optimize' -d
    '{"max_num_segments":"1","wait_for_merge":"false"}'
    ,but no change in the index,it can't optimize.
  3. i use java api,how can i traversal SearchHit.getHighlightFields() ?

You need to pass the parameters as URI parameters, not within the body of
hte optimize request in json. For example: .../_optimize?max_num_segments=1

On Mon, Dec 19, 2011 at 4:23 AM, 冯秉健 elvisbingjian@gmail.com wrote:

Hi all
I Just beginning to learn elasticsearch,have some quesstion as

  1. how can i set index optimize threshold in configuration files ?
  2. i send an order as
    curl -XPOST 'http://localhost:9200/gindex/_optimize' -d
    '{"max_num_segments":"1","wait_for_merge":"false"}'
    ,but no change in the index,it can't optimize.
  3. i use java api,how can i traversal SearchHit.getHighlightFields() ?

Optimize is not really recommended in Lucene, it is bad when you have
realtime requirements and/or a large index ... just decrease the
merge_factor IMO:

regarding 3. do you look for something like

client.search(request).actionGet().hits().getHits()
[0].getHighlightFields()

or what is your question?

Peter.

On 19 Dez., 03:23, 冯秉健 elvisbingj...@gmail.com wrote:

Hi all
I Just beginning to learn elasticsearch,have some quesstion as

  1. how can i set index optimize threshold in configuration files ?
  2. i send an order as
    curl -XPOST 'http://localhost:9200/gindex/_optimize'-d
    '{"max_num_segments":"1","wait_for_merge":"false"}'
    ,but no change in the index,it can't optimize.
  3. i use java api,how can i traversal SearchHit.getHighlightFields() ?

I think that it has its place (merging down to X segments)...

On Tue, Dec 20, 2011 at 9:35 PM, Karussell tableyourtime@googlemail.comwrote:

Optimize is not really recommended in Lucene, it is bad when you have
realtime requirements and/or a large index ... just decrease the
merge_factor IMO:

Elasticsearch Platform — Find real-time answers at scale | Elastic

regarding 3. do you look for something like

client.search(request).actionGet().hits().getHits()
[0].getHighlightFields()

or what is your question?

Peter.

On 19 Dez., 03:23, 冯秉健 elvisbingj...@gmail.com wrote:

Hi all
I Just beginning to learn elasticsearch,have some quesstion as

  1. how can i set index optimize threshold in configuration files ?
  2. i send an order as
    curl -XPOST 'http://localhost:9200/gindex/_optimize'-d
    '{"max_num_segments":"1","wait_for_merge":"false"}'
    ,but no change in the index,it can't optimize.
  3. i use java api,how can i traversal SearchHit.getHighlightFields() ?

I think that it has its place (merging down to X segments)...

Yes, of course. Just wanted to point it out as I also misused it in my
early times :wink:

Peter.