Re: allow_explicit_index and _bulk

2014-10-27 Thread Niccolò Becchi
Sorry my friends,
my mistake, after one week I have discovered that the correct syntax is:

POST /foo/bar/_bulk
{ index: {_id : 1} }
{baz: foobar }

It works! Thanks
Niccolo


Il giorno giovedì 23 ottobre 2014 16:39:39 UTC+1, Niccolò Becchi ha scritto:

 Thanks Jörg for the prompt answer. However, for security reason we have 
 disabled the option rest.action.multi.allow_
 explicit_index ( 
 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html
  
 http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Furl-access-control.htmlsa=Dsntz=1usg=AFQjCNEtPcfFx_JMPzCxDP2x2dyHm8T_GA
  
 ).

 So, in this case using:

 POST /_bulk
 { index : { _index: foo, _type: bar, _id : 1 } }
 { baz: foobar }

 I am getting this exception:
 {
error: ElasticsearchIllegalArgumentException[explicit index in bulk 
 is not allowed],
status: 400
 }

 Is there any way to insert a document, specifying the id, in the bulk mode 
 with no explicit index in bulk, as this code doesn't work:

 POST /foo/bar/_bulk
 { index: {} }
 { _id : 1, baz: foobar }

 Else is this a bug/feature to be implemented?

 Il giorno giovedì 23 ottobre 2014 10:27:34 UTC+1, Jörg Prante ha scritto:

 The bulk format does not allow _id in the payload line, you confuse the 
 indexer.

 Use something like

 POST /_bulk
 { index : { _index: foo, _type: bar, _id : 1 } }
 { baz: foobar }

 Jörg


 On Wed, Oct 22, 2014 at 8:47 PM, Niccolò Becchi niccolo...@gmail.com 
 wrote:

 This issue looks to be fixed on 
 https://github.com/elasticsearch/elasticsearch/issues/4668

 However, on elasticsearch-1.3.4, running the example with 
 rest.action.multi.allow_explicit_index: false:
 ```
 POST /foo/bar/_bulk
 { index: {} }
 { _id : 1, baz: foobar }
 ```
 I am getting the exception:
 ```
 {
took: 1,
errors: true,
items: [
   {
  create: {
 _index: foo,
 _type: bar,
 _id: oX0Xp8dzRbySZiKX8QI0zw,
 status: 400,
 error: MapperParsingException[failed to parse [_id]]; 
 nested: MapperParsingException[Provided id [oX0Xp8dzRbySZiKX8QI0zw] does 
 not match the content one [1]]; 
  }
   }
]
 }
 ```
 Am I doing something wrong or something has changed?

 Il giorno giovedì 9 gennaio 2014 15:38:46 UTC, Gabe Gorelick-Feldman ha 
 scritto:

 Opened an issue: https://github.com/elasticsearch/elasticsearch/
 issues/4668

 On Thursday, January 9, 2014 3:39:39 AM UTC-5, Alexander Reelsen wrote:

 Hey,

 after having a very quick look, it looks like a bug (or wrong 
 documentation, need to check further). Can you create a github issue?

 Thanks!


 --Alex


 On Wed, Jan 8, 2014 at 11:08 PM, Gabe Gorelick-Feldman 
 gabego...@gmail.com wrote:

 The documentation on URL-based access control 
 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html
  implies 
 that _bulk still works if you set 
 rest.action.multi.allow_explicit_index: 
 false, as long as you specify the index in the URL. However, I can't 
 get it to work.

 POST /foo/bar/_bulk
 { index: {} }
 { _id: 1234, baz: foobar }

 returns 

 explicit index in bulk is not allowed

 Should this work?

 -- 
 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 elasticsearc...@googlegroups.com.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%
 40googlegroups.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 elasticsearc...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com
  
 https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/b5f5d61c-93c5-4705-9d95-a84ef2a168e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: allow_explicit_index and _bulk

2014-10-22 Thread Niccolò Becchi
This issue looks to be fixed on 
https://github.com/elasticsearch/elasticsearch/issues/4668

However, on elasticsearch-1.3.4, running the example with 
rest.action.multi.allow_explicit_index: false:
```
POST /foo/bar/_bulk
{ index: {} }
{ _id : 1, baz: foobar }
```
I am getting the exception:
```
{
   took: 1,
   errors: true,
   items: [
  {
 create: {
_index: foo,
_type: bar,
_id: oX0Xp8dzRbySZiKX8QI0zw,
status: 400,
error: MapperParsingException[failed to parse [_id]]; 
nested: MapperParsingException[Provided id [oX0Xp8dzRbySZiKX8QI0zw] does 
not match the content one [1]]; 
 }
  }
   ]
}
```
Am I doing something wrong or something has changed?

Il giorno giovedì 9 gennaio 2014 15:38:46 UTC, Gabe Gorelick-Feldman ha 
scritto:

 Opened an issue: 
 https://github.com/elasticsearch/elasticsearch/issues/4668

 On Thursday, January 9, 2014 3:39:39 AM UTC-5, Alexander Reelsen wrote:

 Hey,

 after having a very quick look, it looks like a bug (or wrong 
 documentation, need to check further). Can you create a github issue?

 Thanks!


 --Alex


 On Wed, Jan 8, 2014 at 11:08 PM, Gabe Gorelick-Feldman 
 gabego...@gmail.com wrote:

 The documentation on URL-based access control 
 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html
  implies 
 that _bulk still works if you set rest.action.multi.allow_explicit_index: 
 false, as long as you specify the index in the URL. However, I can't 
 get it to work.

 POST /foo/bar/_bulk
 { index: {} }
 { _id: 1234, baz: foobar }

 returns 

 explicit index in bulk is not allowed

 Should this work?

 -- 
 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 elasticsearc...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%40googlegroups.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Query with boost by fields an term proximity (similar to EDISMAX in SOLR)

2014-04-07 Thread Niccolò Becchi
Is there anyway to configure a query in a similar way as edismax in SOLR 
that's taking care about term proximity and boosting by fields?
I have spend days but actually I haven't found any good solution with 
elasticsearch

That's an example of edismax in SOLR ( 
http://wiki.apache.org/solr/ExtendedDisMax ):

params.set(q, london market bonds);
params.set(qf, subject title^5);
params.set(pf, subject^10 title^50);
params.set(ps, 10);
params.set(pf2, subject^5 title^25);
params.set(ps2, 20);
params.set(mm, 2);
params.set(tie, 0.8);

It's translated in the following Lucene query:

+(
(
(title:london^5.0 | subject:london)~0.8
(title:market^5.0 | subject:market)~0.8
(title:bonds^5.0 | subject:bond)~0.8
)
~2
) 
(subject:london market bond~10^10.0)~0.8 
(title:london market bonds~10^50.0)~0.8 
(
(subject:london market~20^5.0)~0.8 
(subject:market bond~20^5.0)~0.8
) 
(
(title:london market~20^25.0)~0.8
(title:market bonds~20^25.0)~0.8
)


With the new Multiple query strings in elasticsearch 1.1 ( 
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/multi-query-strings.html
 
) you can do something similar, but you have no control on the terms 
proximity.
So, looking for two terms, there is no difference if the two terms are far. 


Thanks
Niccolo

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a88d7758-f9c9-455c-8db2-1ff4d7c12430%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Anyway to boost a query by fields an term proximity (similar to EDISMAX in SOLR)

2014-04-07 Thread Niccolò Becchi
Is there anyway to configure a query in a similar way as edismax in SOLR 
that's taking care about term proximity and boosting by fields?
I have spend days but actually I haven't found any good solution with 
elasticsearch

That's an example of edismax in SOLR ( 
http://wiki.apache.org/solr/ExtendedDisMax ):

params.set(q, london market bonds);
params.set(qf, subject title^5);
params.set(pf, subject^10 title^50);
params.set(ps, 10);
params.set(pf2, subject^5 title^25);
params.set(ps2, 20);
params.set(mm, 2);
params.set(tie, 0.8);

It's translated in the following Lucene query:

+(
(
(title:london^5.0 | subject:london)~0.8
(title:market^5.0 | subject:market)~0.8
(title:bonds^5.0 | subject:bond)~0.8
)
~2
) 
(subject:london market bond~10^10.0)~0.8 
(title:london market bonds~10^50.0)~0.8 
(
(subject:london market~20^5.0)~0.8 
(subject:market bond~20^5.0)~0.8
) 
(
(title:london market~20^25.0)~0.8
(title:market bonds~20^25.0)~0.8
)


With the new Multiple query strings in elasticsearch 1.1 ( 
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/multi-query-strings.html)
 you can do something similar, but you have no control on the terms 
proximity.
So, looking for two terms, there is no difference if the two terms are far. 
But this feature is too important if you are looking for example for a 
person with a query like Michael Johnson.


Thanks
Niccolo

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/5fc1f929-ddb2-4178-a5da-c87ab81104f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Boosting by fields an Term proximity(similar to EDISMAX in SOLR) is possible with ES?

2014-04-07 Thread Niccolò Becchi
Is there anyway to configure a query in a similar way as edismax in SOLR 
that's taking care about term proximity and boosting by fields?
I have spend days but actually I haven't found any good solution with 
elasticsearch

That's an example of edismax in SOLR ( 
http://wiki.apache.org/solr/ExtendedDisMax ):

params.set(q, london market bonds);
params.set(qf, subject title^5);
params.set(pf, subject^10 title^50);
params.set(ps, 10);
params.set(pf2, subject^5 title^25);
params.set(ps2, 20);
params.set(mm, 2);
params.set(tie, 0.8);

It's translated in the following Lucene query:

+(
(
(title:london^5.0 | subject:london)~0.8
(title:market^5.0 | subject:market)~0.8
(title:bonds^5.0 | subject:bond)~0.8
)
~2
) 
(subject:london market bond~10^10.0)~0.8 
(title:london market bonds~10^50.0)~0.8 
(
(subject:london market~20^5.0)~0.8 
(subject:market bond~20^5.0)~0.8
) 
(
(title:london market~20^25.0)~0.8
(title:market bonds~20^25.0)~0.8
)


With the new Multiple query strings in elasticsearch 1.1 ( 
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/multi-query-strings.html)
 you can do something similar, but you have no control on the terms 
proximity.
So, looking for two terms, there is no difference if the two terms are far. 
But this feature is too important if you are looking for example for a 
person with a query like Michael Johnson.


Thanks
Niccolo

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/d7c50cd6-cae6-494f-a12c-a9378409bcfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Boosting both by FIELD names and TERM PROXIMITY is possible with ES (similar to EDISMAX in SOLR)?

2014-04-07 Thread Niccolò Becchi
Is there anyway to configure a query in a similar way as edismax in SOLR 
that's taking care about term proximity and boosting by fields?
I have spend days but actually I haven't found any good solution with 
elasticsearch

That's an example of edismax in SOLR ( 
http://wiki.apache.org/solr/ExtendedDisMax ):
   
params.set(q, london market bonds);
params.set(qf, subject title^5);
params.set(pf, subject^10 title^50);
params.set(ps, 10);
params.set(pf2, subject^5 title^25);
params.set(ps2, 20);
params.set(mm, 2);
params.set(tie, 0.8);

It's translated in the following Lucene query:

+(
(
(title:london^5.0 | subject:london)~0.8
(title:market^5.0 | subject:market)~0.8
(title:bonds^5.0 | subject:bond)~0.8
)
~2
)
(subject:london market bond~10^10.0)~0.8
(title:london market bonds~10^50.0)~0.8
(
(subject:london market~20^5.0)~0.8
(subject:market bond~20^5.0)~0.8
)
(
(title:london market~20^25.0)~0.8
(title:market bonds~20^25.0)~0.8
)


With the new Multiple query strings in elasticsearch 1.1 ( 
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/multi-query-strings.html
 
) you can do something similar, but you have no control on the terms 
proximity.
So, looking for two terms, there is no difference if the two terms are far. 
But this feature is too important if you are looking for example for a 
person with a query like Michael Johnson.


Thanks
Niccolo

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/07c187f6-a0d4-4b52-8931-6b4941fe44c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing date field in a native (Java) script

2014-03-31 Thread Niccolò Becchi
Sorry Bihn,
just seen now your suggestion but It doesn't work.
For a field* datePublished: {format: dateOptionalTime, type: date}* when 
I perform:

ScriptDocValues v = (ScriptDocValues) doc().get(dateField);

I got an object 
org.elasticsearch.index.fielddata.ScriptDocValues$Strings@5e834b36 that's 
containing the following strings:

[01, 12, 15z, 2014, 30t10]

For the following date 2014-01-30T10:12:15Z stored in ES. I don't know how 
to fix it.
Thanks a lot
Niccolo'


Il giorno lunedì 10 marzo 2014 18:22:23 UTC, Binh Ly ha scritto:

 If you do something like this, you should get the epoch value in 
 milliseconds. Then you can use that value to initialize whatever object you 
 want:

   ScriptDocValues v = (ScriptDocValues) doc().get(dateField);
   if (v != null  !v.isEmpty()) {
 long epoch_ms = ((Longs)v).getValue();
   }



-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/deb72f15-f765-4287-b073-b9ddce1ef7fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Accessing date field in a native (Java) script

2014-03-07 Thread Niccolò Becchi
Hi,
I haven't been able to find any examples about how to access to a date 
field inside a java native script.
I have a 'datePublished' field defined as following in the mapping:

mappings: { 

   - doc: { 
  - properties: { 
 - ...
 - datePublished: { 
- format: dateOptionalTime
- type: date
 }
  }
   }

}

However, inside the class:

public class ScoreByAgeScript extends AbstractDoubleSearchScript {

public ScoreByAgeScript(@Nullable MapString,Object params) {
...
}

@Override
public double runAsDouble() {
Object datePublishedStr = source().get(fieldDate); // = Get a 
string  2013-07-07T12:00:00
Object datePublishedDoc = doc().get(fieldDate);   //  = Get a 
list of strings [00, 03, 07t12, 2013] 
}

}

I have been able only to the string text.
I could eventually parse the text to a Date Java object but I would prefer 
to avoid it, avoiding any problem about string format or timezone, etc..
Is there any way to get the java date Object?
Thanks
Niccolo

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/37cfcecc-400a-4344-95fb-77ab6509520a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.