Re: Update API - how to remove inner fields from objects via script?

2015-02-22 Thread Steve Flook
Nevermind folks thanks anyway.  I took a look at the ES source.  Each 
object in the doc has it's own methods such as remove():

POST 
/test-timbr-2015.02.19/event/0f78c6b6-a30b-436e-bad7-4234654fc5bb/_update
{
script : ctx._source.realm.remove(\name http://realm.name/\)
}

On Friday, February 20, 2015 at 10:54:30 AM UTC-5, Steve Flook wrote:

 I have an index that supports dynamic mappings under a field of type 
 Object that we named custom.  My doc also has other objects properties with 
 inner props.  I attached an abbreviated mapping - notice my object for 
 realm and it's properties

 Using the Update API I can remove a field per the docs 
 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-update.html
  
 *if* it's a top level field.  For example this works great:

 POST 
 /test-timbr-2015.02.19/event/0f78c6b6-a30b-436e-bad7-4234654fc5bb/_update
 {
 script : ctx._source.remove(\threadid\)
 }

 However, when I run the script against a document that has a field nested 
 in a specific object graph the specified field doesn't get deleted.  I'm 
 using dot notation as you can see, and when I run this ES comes back with a 
 HTTP 200 and the _version property gets incremented.

 POST 
 /test-timbr-2015.02.19/event/0f78c6b6-a30b-436e-bad7-4234654fc5bb/_update
 {
 script : ctx._source.remove(\realm.name\)
 }

 How can I get inner properties like this removed via the Update API.

 Thanks for your help.
 Steve


-- 
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/e608a60c-0741-4abb-a82d-0d2515c4359d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Searching with Elasticsearch.Net

2015-01-10 Thread Steve Flook
I think you are just getting unlucky.  You are asking for the top 10 
results, starting *after *result number 10.  Only problem is the search 
response is saying there is only 10 results total, so there are no hits to 
return.

Try changing your from to 0, instead of 1 * 10.  Or you can just omit that 
all together, as ES will default to 0.

If you are coming from the world of sql, one difference in simple queries 
is ES gives back the total number of results with that total property you 
see in the response's hits section.  So even if you ask for only 10 
documents, total will give you the full count no matter what.

Steve

On Friday, January 9, 2015 at 12:43:36 PM UTC-5, Garrett Johnson wrote:

 Hi All,

 I would like to use Elasticsearch.Net (NEST requires types and I do not 
 want strong types) to do a simple _all term search.  I can do this using 
 the plugin elasticsearch head and I retrieve the appropriate documents.  
 Here is some simple code I wrote just to say hey give me all that match.

 var node = new Uri(http://myhost:9200);

 var config = new ConnectionConfiguration(node); 

 var exposed = config.ExposeRawResponse(true);

 var client = new ElasticsearchClient(config);

 var search = new

 {

 size = 10,

 from = 1 * 10,

 query = new { query_string = new { query = this.textBox1.Text } },

 };

 var searchResponse = client.Search(jdbc,search);

 This returns these results:

 {StatusCode: 200, 
  Method: POST, 
  Url: http://u4vmeqlditapp01:9200/jdbc/_search, 
  Request: 
 {size:10,from:10,query:{query_string:{query:Garrett}}}, 
  Response: 
 {took:5,timed_out:false,_shards:{total:5,successful:5,failed:0},hits:{total:10,max_score:1.1672286,hits:[]}}}

 But no documents.

 Here is the JSON I'm trying to replicate:



- query: {
   - bool: {
  - must: [
 - {
- query_string: {
   - default_field: _all,
   - query: Garrett
}
 }
  ],
  - must_not: [ ],
  - should: [ ]
   }
},
- from: 0,
- size: 25000,
- sort: [ ],
- facets: { }


 I'm pretty sure it is because the query doesn't have the default_field set 
 to _all... But I don't know how to set that.  I've tried several string 
 concatenations to no avail it just searched for them.

 Any one with any ideas.  I want to simply search all types for a single 
 string.

 Garrett







-- 
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/b4c0a2ac-acdb-43fb-a238-88520a4c1be5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.