ServerError:400类型:search_phase_execution_exception原因:“所有分片均失败”

时间:2019-05-21 11:31:09

标签: elasticsearch asp.net-core-2.1 elasticsearch-geo-shape

我正在将Elasticsearch与.net core 2.1一起使用,并且具有以下用于搜索的代码,

  var Buildingpoints= _elasticClient.Search<ElasticSearchModel>(
                     s => s.From(0).Size(600).Query(query => query.Bool(b => b
                     .Filter(filter => filter
                    .GeoDistance(geo => geo
                   .Field(f => f.Location)
                   .Distance(4.0, Nest.DistanceUnit.Kilometers)
                   .Location(41.23, 69.32)
                    ))                                 
                 )
               ));

但是我得到这样的错误 {ServerError:400Type:search_phase_execution_exception原因:“所有分片失败”} 我的索引代码是这样的:

var result = query.Skip(h.PageSize * (h.CurrentPage - 1))
                                  .Take(h.PageSize)
                                  .AsEnumerable()
                                  .Select(a =>
                                  {
                                      var building = a.MapTo<ElasticSearchModel>();
                                      building.Location= new GeoLocation(Convert.ToDouble(a.Latitude), Convert.ToDouble(a.Longitude));
                                      building.LoadEntity(a);
                                      return building;
                                  });

                var searchResult = new SearchResult
                {

                    Building = result,
                    TotalCount = totalCount
                };

                foreach (var post in searchResult.Building)

                {
                    await _elasticClient.IndexDocumentAsync(post);
                }

                return Ok($" {searchResult.TotalCount} building(s) reindexed");
            }

,索引结果为:

"_index": "honadonx",
"_type": "_doc",
"_id": "2750",
"_version": 1,
"_score": 1,
"_source": {
"location": {
"lat": 41.42168372033083,
"lon": 69.20530557632446
},
"id": 2750,
"buildTitle": " Соток 2,27 4+1 Ошхона",
"createdDate": "2019-04-30T13:16:39.6384603",
"totalRooms": 4,
"description": " Соток 2,27 : 4+1 Ошхона Шароити::fire::zap::droplet: бор Кошимча: 1 падвал бор 4та Мошина сигади : 95% битган 38000$ +998974408004 +998993048004 Манзил: Битонка пост гаидан 4км Келес Кук-терак Улугбек кучасида",
"ownerPrice": 38000,
"size": 2,
"sizeName": "kv",
"moneyType": "Dollar",
"buildAction": "Sotiladi",
"buildType": "Xususiy uy",
"address": " Битонка пост гаидан 4км Келес Кук-терак Улугбек кучасида",
"buildingRooms": [

我如何更改索引代码以保存位置,或者我对索引有另一个问题? 请帮助我解决我在Elasticsearch中刚遇到的这个问题,而我已经失去了很多天的解决方案。

0 个答案:

没有答案