# Keep Strings when Labeling

**URL:** <https://discuss.elastic.co/t/keep-strings-when-labeling/59351>\
**Category:** Kibana\
**Tags:** elastic-stack-graph\
**Created:** [August 30, 2016, 6:19pm UTC](https://discuss.elastic.co/t/keep-strings-when-labeling/59351 "2016-08-30T18:19:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yeikel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yeikel/32/125434_2.png) [@yeikel](https://discuss.elastic.co/u/yeikel)\
**Post date:** [August 30, 2016, 6:19pm UTC](https://discuss.elastic.co/t/keep-strings-when-labeling/59351/1 "2016-08-30T18:19:13Z")

</div>

I have the following sample Json file:

```
`{"id":1,"name":"Rachel Moreno","street":"Kinsman","gender":"Female","email":"rmoreno0@huffingtonpost.com","username":"rmoreno0","credit_card_type":"mastercard","balance":"$65306.75","credit_card_number":"5100137085196689","currency_code":"MNT","job_title":"Senior Financial Analyst","company_name":"Vidoo"}`

```

I ingested it with logstash and generated the following document :

```
{
  "_index": "mockdata",
  "_type": "logs",
  "_id": "AVbckgRz8F8VRgCfhXm7",
  "_score": null,
  "_source": {
    "@version": "1",
    "@timestamp": "2016-08-30T17:49:30.629Z",
    "id": 1,
    "name": "Rachel Moreno",
    "street": "Kinsman",
    "gender": "Female",
    "email": "rmoreno0@huffingtonpost.com",
    "username": "rmoreno0",
    "credit_card_type": "mastercard",
    "balance": "$65306.75",
    "credit_card_number": "5100137085196689",
    "currency_code": "MNT",
    "job_title": "Senior Financial Analyst",
    "company_name": "Vidoo"
  },
  "fields": {
    "@timestamp": [
      1472579370629
    ]
  },
  "highlight": {
    "name": [
      "@kibana-highlighted-field@Rachel@/kibana-highlighted-field@ @kibana-highlighted-field@Moreno@/kibana-highlighted-field@"
    ]
  },
  "sort": [
    1472579370629
  ]
}

```

I am trying to build a graph that connects fields in a structure like the following :

Name   
job\_title

The very first query that I ran is the following :

```
GET mockdata/_graph/explore
{
	"query": {
		"query_string": {
			"default_field": "_all",
			"query": "\"Rachel Moreno\""
		}
	},
	"controls": {
		"use_significance": true,
		"sample_size": 2000,
		"timeout": 5000
	},
	"connections": {
		"vertices": [
			{
				"field": "job_title",
				"size": 1,
				"min_doc_count": 1
			}
		]
	},
	"vertices": [
		{
			"field": "job_title",
			"size": 1,
			"min_doc_count": 1
		}
	]
}

```

And this is the response that I received

```
{
  "took": 0,
  "timed_out": false,
  "failures": [],
  "vertices": [
    {
      "field": "job_title",
      "term": "analyst",
      "weight": 1,
      "depth": 0
    },
    {
      "field": "job_title",
      "term": "financial",
      "weight": 0.95,
      "depth": 1
    }
  ],
  "connections": [
    {
      "source": 0,
      "target": 1,
      "weight": 0.95,
      "doc_count": 17
    }
  ]
}

```

 ![](https://us1.discourse-cdn.com/elastic/original/2X/d/d41d1c44d9c306f813f0a2750164eae1d7497b24.png)

The problem is that this creates two vertices Analyst and Financial when what I am looking for is to produce just one vertice.

My desired result should be

Name \ Rachel Moreno  
job\_title Senior Financial Analyst

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [August 30, 2016, 9:25pm UTC](https://discuss.elastic.co/t/keep-strings-when-labeling/59351/2 "2016-08-30T21:25:29Z")

</div>

You've hit the classic `new` and `york` problem when you really want to see just `new york`.

This is addressed using mappings and the following is a useful guide to preparing content for both search and analytics: [https://www.elastic.co/guide/en/elasticsearch/guide/master/aggregations-and-analysis.html](https://www.elastic.co/guide/en/elasticsearch/guide/master/aggregations-and-analysis.html)

---

<div class="post-metadata">

**Author:** ![yeikel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yeikel/32/125434_2.png) [@yeikel](https://discuss.elastic.co/u/yeikel)\
**Post date:** [August 31, 2016, 3:07am UTC](https://discuss.elastic.co/t/keep-strings-when-labeling/59351/3 "2016-08-31T03:07:02Z")

</div>

That's indeed the problem. Thank you

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/keep-strings-when-labeling/59351/4 "2017-07-06T13:42:37Z")

</div>

Closed on July 6, 2017, 1:42pm UTC


