Some quesstion about elasticsearch index optimization


(冯秉健) #1

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() ?

(Shay Banon) #2

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() ?

(Karussell) #3

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:

http://www.elasticsearch.org/guide/reference/index-modules/merge.html

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() ?

(Shay Banon) #4

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:

http://www.elasticsearch.org/guide/reference/index-modules/merge.html

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() ?

(Karussell) #5

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.


(system) #6