According to ES these have been deprecated in 2.1.
https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_21_search_changes.html
For my particular use case I need to get the complete list of document IDs that match a search. I have been using search_type=scan. Would it be possible to add an enumeration for scroll to SearchType
so that it is used on the URL instead of scan?
ES now recommends getting all doc IDs using scroll and sorting by _doc.
GET /my_index/_search?scroll=2m
{
"sort": [
"_doc"
]
}
Thanks.
Does this question on StackOverflow help?
http://stackoverflow.com/questions/34754518/elasticsearch-2-1-deprecated-search-types
You say you need a complete list of document IDs, why can you not get them anymore?
search_type=scan and search_type=count are deprecated in Elasticsearch 2.1 but NEST client 2.0 also needs to support ES 2.0.x so we would want to keep them for compatibility. Adding an enum value of scroll for search_type is not going to work because the SearchType enum sets the search_type query string parameter key and value which we don't want to set for scroll.
As @RobinRieger has noted, the way to acheive this using NEST 2.x and ES 2.1 is the following:
``` c#
var response = client.Search
.Scroll("2m")
.Sort(ss => ss
.Ascending(SortSpecialField.DocumentIndexOrder)
)
);
which will result in a request like
POST http://localhost:9200/_search?scroll=2m
{
"sort": [{
"_doc": {
"order": "asc"
}
}]
}
```
The default sort order for fields is ascending (except _score, whose default is descending).
Most helpful comment
search_type=scanandsearch_type=countare deprecated in Elasticsearch 2.1 but NEST client 2.0 also needs to support ES 2.0.x so we would want to keep them for compatibility. Adding an enum value ofscrollforsearch_typeis not going to work because theSearchTypeenum sets thesearch_typequery string parameter key and value which we don't want to set forscroll.As @RobinRieger has noted, the way to acheive this using NEST 2.x and ES 2.1 is the following:
``` c#(s => s
var response = client.Search
.Scroll("2m")
.Sort(ss => ss
.Ascending(SortSpecialField.DocumentIndexOrder)
)
);
POST http://localhost:9200/_search?scroll=2m
{
"sort": [{
"_doc": {
"order": "asc"
}
}]
}
```
The default sort order for fields is ascending (except
_score, whose default is descending).